BlocProvider<T extends BaseBloc> constructor
Create a BlocProvider that provides a bloc to all descendants.
The bloc created on first access, by calling initBloc
.
BaseBloc.dispose will be called when BlocProvider is removed from the tree permanently (State.dispose called).
Implementation
BlocProvider({
Key? key,
required T Function(BuildContext) initBloc,
Widget? child,
}) : _provider = Provider<T>.factory(
initBloc,
key: key,
disposer: (bloc) => bloc.dispose(),
child: child,
),
super(key: key);