should_rebuild 0.1.0 copy "should_rebuild: ^0.1.0" to clipboard
should_rebuild: ^0.1.0 copied to clipboard

outdated

A widget can prevent Child Widget unnecessary rebuild.You can filter whether you need rebuild based on whether the property values received by the old Child Widget and the new Child Widget are equal.

ShouldRebuild #

Star this Repo pub package License GitHub issues GitHub forks

A widget can prevent Child Widget unnecessary rebuild.You can filter whether you need rebuild based on whether the property values received by the old Child Widget and the new Child Widget are equal.

(这个widget可以防止它的child发生不必要的rebuild,你可以判断新的Child Widget和旧的Child Widget接收的属性值是否相等来过滤是否需要rebuild)

Add dependency #

dependencies:
  should_rebuild: 0.1.0

Or

dependencies:
  should_rebuild:
      git:
        url: https://github.com/fluttercandies/should_rebuild

Super simple to use #

ShouldRebuild<Todo>(
    shouldRebuild: (oldWidget, newWidget) => oldWidget.counter != newWidget.counter,
    child: Todo(counter: counter,)
),

Todo Widget

class Todo extends StatelessWidget {
  final int counter;
  Todo({this.counter});
  @override
  Widget build(BuildContext context) {
    return Container(
      child: Text(counter.toString()),
    );
  }
}

The Todo widget only rebuild if counter changes

ShouldRebuild Widget is a generic StatefulWidget,this generic represents the type of Widget returned by the builder method

27
likes
0
points
702
downloads

Publisher

unverified uploader

Weekly Downloads

A widget can prevent Child Widget unnecessary rebuild.You can filter whether you need rebuild based on whether the property values received by the old Child Widget and the new Child Widget are equal.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on should_rebuild