stateManager property
B
stateManager
latefinal
The state manager instance for this page, automatically initialized with dependencies.
This property provides access to the state management object that can be either a Bloc (for event-driven state management) or a Cubit (for direct method calls).
In subclasses:
- BaseBlocPageState provides a typed
blocgetter that returns this as the correct Bloc type - BaseCubitPageState provides a typed
cubitgetter that returns this as the correct Cubit type
Example usage:
// In BaseBlocPageState subclasses, use the bloc getter:
bloc.add(CounterEvent.increment());
// In BaseCubitPageState subclasses, use the cubit getter:
cubit.increment();
The state manager is automatically disposed when the page is disposed.
Implementation
late final B stateManager =
di<B>() as dynamic
..commonBloc = commonBloc
..navigator = navigator;