Computed<T> class

A computed reactive value.

Computed values are:

  • Lazy: Only computed when accessed
  • Cached: Reuses the last value if dependencies haven't changed
  • Reactive: Tracks its own dependents and notifies them when it changes
Available extensions

Constructors

Computed(T _getter())
Creates a new computed value with the given getter function.

Properties

hashCode int
The hash code for this object.
no setterinherited
isDirty bool
Whether the computed value needs to be recalculated.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value → T
The computed value.
no setter

Methods

asReadonly() Readonly<T>

Available on Computed<T>, provided by the ReadonlyComputed extension

Create a readonly view of this computed.
call() → T
Makes Computed callable, returning the reactive value.
invalidate() → void
Force the computed to recalculate on next access.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override
watch(BuildContext context) → T

Available on Computed<T>, provided by the ComputedWatchExtension extension

Watch this computed's value and rebuild only this widget when it changes.

Operators

operator ==(Object other) bool
The equality operator.
inherited