LocatorReactionStateMixin<T extends StatefulWidget> mixin
Null safety
Convenience mixin that provides MobX reaction functions which can rely on the surrounding ObservableLocatorScope.
autorunWithLocator and reactionWithLocator are similar to their
autorun
and reaction
function counterparts, but these functions will
also re-run their callbacks if the ObservableLocatorScope provides a
different locator. This avoids reactions that listen to stale locators.
Furthermore, reactions made with these functions are also automatically
disposed when the widget is disposed. They can still be disposed early
by calling the provided reaction disposer or disposing the reaction in
the fn
callback.
- Superclass Constraints
- State<
T>
- State<
- Annotations
Properties
- widget → T
-
The current configuration.
read-onlyinherited
- context → BuildContext
-
The location in the tree where this widget builds.
read-onlyinherited
- mounted → bool
-
Whether this State object is currently in a tree.
read-onlyinherited
- hashCode → int
-
The hash code for this object.
read-onlyinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
Methods
-
activate(
) → void - Called when this object is reinserted into the tree after having been removed via deactivate.
-
autorunWithLocator(
LocatorAutorunFn fn, {String? name, int? delay, ReactiveContext? context, OnError? onError}) → ReactionDisposer -
Executes the specified
fn
, whenever the dependent observables change. Also executesfn
when the observable locator scope changes. -
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
@protectedinherited
-
deactivate(
) → void - Called when this object is removed from the tree.
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
didChangeDependencies(
) → void -
Called when a dependency of this State object changes.
override
-
didUpdateWidget(
covariant T oldWidget) → void - Called whenever the widget configuration changes.
-
dispose(
) → void -
Called when this object is removed from the tree permanently.
override
-
initState(
) → void - Called when this object is inserted into the tree.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.
inherited
-
reactionWithLocator<
T> (LocatorReactionFn< T> fn, ReactionEffect<T> effect, {String? name, int? delay, bool? fireImmediately, EqualityComparer<T> ? equals, ReactiveContext? context, OnError? onError}) → ReactionDisposer -
Executes the
fn
function and tracks the observables used in it, re-executing whenever the dependent observables change or the observable locator scope changes. If theT
value returned byfn
is different, theeffect
function is executed. -
reassemble(
) → void - Called whenever the application is reassembled during debugging, for example during hot reload.
-
setState(
VoidCallback fn) → void -
Notify the framework that the internal state of this object has changed.
@protectedinherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringShort(
) → String -
A brief description of this object, usually just the runtimeType and the
hashCode.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited