ReactiveBlock class
A reactive block outside the widget tree.
Runs the given function immediately and re-runs it whenever any observable
it read through watch changes — the non-widget counterpart of Obx, and
an alternative to a controller's sync that discovers its dependencies
instead of taking them as an explicit list.
_block = ReactiveBlock((ref) {
state.canSubmit.value =
ref.watch(state.amount) > 0 && !ref.watch(state.isBusy);
});
Nothing cancels it for you: call dispose from the owner's dispose.
- Implemented types
Constructors
- ReactiveBlock(void _reactiveBlockFunc(ReactiveBlockRef ref))
-
Creates the block and runs
_reactiveBlockFunconce, immediately.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
dispose(
) → void - Cancels every subscription the block picked up.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
watch<
T> (ValueListenable< T> observable) → T -
Returns the current value of
observableand subscribes the enclosing reactive block to it.override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited