InitialDataCompute<TQueryData> class final Option values

The InitialData.compute variant: a seed computed lazily, for as long as the query has no data.

initialData: InitialData.compute(
  () => client
      .getQueryData<List<Task>>(QueryKey(['tasks']))
      ?.where((task) => task.id == id)
      .firstOrNull,
),
Inheritance

Constructors

InitialDataCompute(TQueryData? compute())
Seeds the cache with what compute returns, unless that is null.
const

Properties

compute → TQueryData? Function()
Called when the query is created, and again on every options update — every observer rebuild, equal options included — and every fetch, until the query holds data; once seeded or fetched it is never consulted again. That matches TanStack Query's behaviour, and it is what lets a detail seed itself from a list that arrives later.
final
hashCode → int
The hash code for this object.
no setteroverride
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
seed() → ({TQueryData? data, bool hasData})
The seed, and whether there is one.
inherited
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
override