Search packages, repositories and app categories

GitHub repositoryfantasy525/should_rebuild

should_rebuild

fantasy525/should_rebuild open-source repository details.

should_rebuild project cover
Stars
40
Forks
8
Last push (UTC)
Sep 3, 2021
Project status
Active

Original README

English project snapshot. Visit GitHub for the latest content.

ShouldRebuild

Star this Repo pub package License GitHub issues GitHub forks

A widget can prevent Child Widget unnecessary rebuilds.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发生不必要的rebuilds,你可以判断新的Child Widget和旧的Child Widget接收的属性值是否相等来过滤是否需要rebuild)

Add dependency
dependencies:
  should_rebuild: 1.0.1

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 rebuilds if counter changes

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

fantasy525 GitHub avatar
GitHub author

fantasy525 ↗

vuejs,react-native,typescript

BeiJing
LanguagesDartShellObjective-CJava

Packages published by this repository

Dependencies used

Dependency list 2 items

  • flutter{"sdk":"flutter"}
  • flutter_testDevelopment{"sdk":"flutter"}

How do I choose a repository?

Start with your use case, compare repository activity, and check the original project before adopting it.

  1. Search by repository name, owner or description, then narrow the results by topic.
  2. Compare stars, forks and recent pushes. Stars show community interest, not a guarantee of quality.
  3. Read the README, license and issues on GitHub before using a project.

Sources and maintenance

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗