BlocProvider<T extends Bloc> constructor
BlocProvider<T extends Bloc> ({
- Key? key,
- required Widget child,
- required T bloc,
- UpdateShouldNotify<
T> ? updateShouldNotifyOverride,
Builds a BlocProvider.
child is the widget that the BlocProvider will wrap.
bloc is the BLoC this provider will be hosting.
updateShouldNotifiyOverride
is an optional parameter that will allow you
to override the default behaviour.
This is the default implementation of the updateShouldNotify
method:
@override
bool updateShouldNotify(_BlocProvider oldWidget) =>
updateShouldNotifyOverride != null
? updateShouldNotifyOverride(bloc, oldWidget)
: oldWidget.bloc != bloc;
Implementation
BlocProvider({
Key? key,
required this.child,
required this.bloc,
this.updateShouldNotifyOverride,
}) : super(key: key);