RebuildRule<T> constructor
A rule over value and observedState: the controller's value, and
everything a reader can see of the controller as one value with value
equality.
For most controllers both are the value. An infinite query's controller
also keeps its paging flags beside the result — a fetch that switches
direction leaves the result untouched — so its observed state is
InfiniteQueryController.observedState, the result and the flags
together.
beside is the part of observedState that is not in value, when
there is one: for an infinite query, the paging flags alone. A reader
shows it, but buildWhen compares values and never sees it, so when it
moves the reader rebuilds whatever buildWhen says of the value. Leave
it out where the observed state is the value, or the value under an
equality of its own.
final rule = RebuildRule<QueryResult<Post>>(
value: () => feed.value,
observedState: () => (feed.value, feed.hasNextPage),
beside: () => feed.hasNextPage,
);
Implementation
RebuildRule({
required T Function() value,
required Object? Function() observedState,
Object? Function()? beside,
}) : _value = value,
_observedState = observedState,
_beside = beside;