RebuildRule<T> class
final
What one reader's last build read from a controller, and whether what the controller holds now is worth a frame.
This is the decision behind every call style of query_kit_flutter, for
packages that read queries in a shape of their own — query_kit_hooks is
one. It holds no controller and listens to nothing: the caller subscribes,
owns and disposes whatever it reads, and asks shouldRebuild from its own
listener.
final rule = RebuildRule.of(controller);
// In the build:
final result = rule.read();
// In the listener:
if (rule.shouldRebuild(buildWhen)) markNeedsBuild();
RebuildRule.of is the rule the call styles use for one of the binding's controllers. A reading shape of its own — several controllers' results under an equality of its own, say — gives the parts one by one to the unnamed constructor.
A change to this class is a major version of query_kit_flutter.
Constructors
- RebuildRule({required T value(), required Object? observedState(), Object? beside()?})
-
A rule over
valueandobservedState: the controller's value, and everything a reader can see of the controller as one value with value equality. -
RebuildRule.of(ValueListenable<
T> controller) -
The rule the call styles use for
controller: its value, everything a reader can see of it, and the part of that beside the value — for anInfiniteQueryController, the paging flags.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
read(
) → T - Reads the current value and records it as this build's, together with the observed state and what is beside the value.
-
shouldRebuild(
BuildWhen< T> ? buildWhen) → bool - Whether what the controller holds now is worth a frame, given what read last recorded.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited