StateNotifierProvider<Controller extends StateNotifier<Value> , Value> constructor
StateNotifierProvider<Controller extends StateNotifier<Value> , Value> ({
- Key? key,
- required Create<
Controller> create, - bool? lazy,
- TransitionBuilder? builder,
- Widget? child,
Creates a StateNotifier instance and exposes both the StateNotifier
and its StateNotifier.state using provider
.
DON'T use this with an existing StateNotifier instance, as removing
the provider from the widget tree will dispose the StateNotifier.
Instead consider using StateNotifierBuilder.
create
cannot be null
.
Implementation
factory StateNotifierProvider({
Key? key,
required Create<Controller> create,
bool? lazy,
TransitionBuilder? builder,
Widget? child,
}) = _StateNotifierProvider<Controller, Value>;