StateNotifierProvider<Controller extends StateNotifier<Value>, Value> constructor

StateNotifierProvider<Controller extends StateNotifier<Value>, Value>({
  1. Key? key,
  2. required Create<Controller> create,
  3. bool? lazy,
  4. TransitionBuilder? builder,
  5. 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>;