RxComputed<T> class
A reactive computed value that automatically tracks observed dependencies and memoizes its result until dependencies change.
- Inheritance
-
- Object
- ChangeNotifier
- ListNotifierSingle
- GetListenable<
T> - RxComputed
- Mixed-in types
Properties
- firstRebuild ↔ bool
-
getter/setter pairinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- hasSubscribers → bool
-
Returns true if there is at least one active listener.
no setterinherited
- isDisposed → bool
-
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sentToStream ↔ bool
-
getter/setter pairinherited
-
stream
→ Stream<
T> -
no setterinherited
- string → String
-
Same as
toString()but using a getter.no setterinherited -
subject
→ StreamController<
T> -
no setterinherited
- value ↔ T
-
The current value of the object.
getter/setter pairinherited-setteroverride-getter
Methods
-
addError(
Object error, [StackTrace? stackTrace]) → void -
Adds an error to the underlying stream controller.
inherited
-
addListener(
VoidCallback listener) → Disposer -
Register a closure to be called when the object changes.
inherited
-
bindStream(
Stream< T> stream, {bool cancelPrevious = false}) → StreamSubscription<T> -
Binds an existing
Stream<T>to thisRx<T>to keep the values in sync. You can bind multiple sources to update the value.inherited -
bindStreamBuilder(
Stream< T> builder(), {bool cancelPrevious = false}) → StreamSubscription<T> -
Same as bindStream, but takes a
builderthat creates the stream on demand instead of a stream instance.inherited -
call(
[T? v]) → T -
Makes this Rx look like a function so you can update a new
value using
rx(someOtherValue). Practical to assign the Rx directly to some Widget that has a signature::onChange(value).inherited -
close(
) → void -
Closes the reactive variable and cleans up resources.
override
-
dispose(
) → void -
Disposes the notifier and cleans up native ChangeNotifier listeners.
inherited
-
forceValue(
T val) → void -
Same as the value setter but without its
==short-circuit — see GetListenable.forceValue. Keeps the setter's disposal guard and stream bookkeeping so the two stay interchangeable in every other respect.inherited -
listen(
void onData(T)?, {Function? onError, void onDone()?, bool? cancelOnError}) → StreamSubscription< T> -
Listens to changes of the reactive variable.
inherited
-
listenAndPump(
void onData(T val), {Function? onError, void onDone()?, bool? cancelOnError}) → StreamSubscription< T> -
Returns a StreamSubscription similar to listen, but with the
added benefit that it primes the stream with the current value, rather
than waiting for the next value. This should not be called in
onInitor anywhere else during the build process.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
onCancel(
) → void -
Called when the last remaining listener is removed.
inherited
-
onListen(
) → void -
Called when a first listener is added after having none.
inherited
-
refresh(
) → void -
Forcefully notifies all listeners about the current value, even if the
value hasn't changed. Useful for refreshing custom objects and triggering UI updates.
inherited
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
reportAdd(
VoidCallback disposer) → void -
Reports a disposer callback to the global notifier.
inherited
-
reportRead(
) → void -
Reports that this notifier was read.
inherited
-
toJson(
) → dynamic -
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object o) → bool -
This equality override works for _RxImpl instances and the internal
values.
inherited
Static Methods
-
create<
T> (T compute()) → RxComputed< T> -
Creates a computed reactive value that tracks dependencies evaluated in
compute.