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


widget → T
The current configuration.
context BuildContext
The location in the tree where this widget builds.
mounted bool
Whether this State object is currently in a tree.
hashCode int
The hash code for this object.
runtimeType Type
A representation of the runtime type of the object.


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 executes fn when the observable locator scope changes.
build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
deactivate() → void
Called when this object is removed from the tree.
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
didChangeDependencies() → void
Called when a dependency of this State object changes.
didUpdateWidget(covariant T oldWidget) → void
Called whenever the widget configuration changes.
dispose() → void
Called when this object is removed from the tree permanently.
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.
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 the T value returned by fn is different, the effect 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.
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
toStringShort() String
A brief description of this object, usually just the runtimeType and the hashCode.


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