Skip to content
pubscout

should_rebuild

1.0.1, released 5 years ago by an unverified publisher

A widget that prevents unnecessary child widget rebuilds by customizing rebuild conditions.

WASM-ready
$ flutter pub add should_rebuild
Source repository

What it does

It provides a generic ShouldRebuild widget that filters out unnecessary child widget rebuilds based on whether property values between the old and new child widgets are equal. The Todo widget or any specified child only rebuilds if the defined condition is met.

AI-written summary of version 1.0.1, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You want to optimize performance by avoiding unnecessary rebuilds of child widgets.
  • You need custom comparison logic to determine if a child widget should update based on its properties.

Skip it when

  • You are already using state management solutions that handle rebuild optimization out of the box.
  • Your widget tree is simple and performance optimization is not a concern.

Strengths

  • Simple and straightforward API to implement conditional rebuilding.
  • Supports null safety.

Weaknesses

  • Limited documentation beyond basic usage examples.
  • Requires manual specification of rebuild conditions for widgets.

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
0

Not documented

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

Alternatives

Packages that do the same job and could replace should_rebuild.