BuildWhen<T> typedef
Reading queries
BuildWhen<T> =
bool Function(T previous, T current)
Whether a reader should rebuild for a change from previous to current
— the buildWhen every call style takes.
It is asked only when the value really changed: a notification carrying
what the reader is already showing never rebuilds, predicate or not. When
it returns false, the reader keeps showing previous — unless something
else rebuilds it — and the next change is compared against what it
shows.
// Rebuild only when the task's name changes:
final task = context.query(
taskQuery(id),
buildWhen: (previous, current) =>
previous.dataOrNull?.name != current.dataOrNull?.name,
);
Implementation
typedef BuildWhen<T> = bool Function(T previous, T current);