BlocProvider<T extends Bloc> constructor

BlocProvider<T extends Bloc>({
  1. Key? key,
  2. required Widget child,
  3. required T bloc,
  4. 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);