lazy_builder_widget

Last updated:

0 purchases

lazy_builder_widget Image
lazy_builder_widget Images
Add to Cart

Description:

lazy builder widget

A builder widget that can prevent rebuilding.
Caution: Preventing rebuilds is a potentially risky action, so use it judiciously.
Usage #

Widget build(BuildContext context) {
return LazyBuilderWidget<MediaQueryData>(
builder: (BuildContext context, MediaQueryData data) {
return Text('Screen width = ${data.size.width}');
},
selector: (BuildContext context) {
// Return the data used to build
return MediaQuery.of(context);
},
buildWhen: (MediaQueryData prev, MediaQueryData curr) {
// Do not rebuild when this route is not the top-most route on the navigator
return ModalRoute.of(context)?.isCurrent ?? true;
},
);
}

copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.