of static method
Returning the closest instance of this class that encloses the given context.
If you give a tag, it will give priority find the corresponding instance of this class with the given tag and return it.
If no instance is found, this method will assert in debug mode, and throw an exception in release mode.
Calling this method will create a dependency on the closest
ObserverWidget in the context.
See also:
ObserverWidget.maybeOf, which is similar to this method, but returns null if noObserverWidgetinstance is found.
Implementation
static MixViewObserverState of(
BuildContext context, {
String? tag,
}) {
final _state = ObserverWidget.of<SliverObserverController, ObserveModel,
ScrollViewOnceObserveNotification, SliverViewObserver>(
context,
tag: tag,
);
return _state as MixViewObserverState;
}