BlocConsumer<B extends BlocBase<S>, S extends Object> constructor

const BlocConsumer<B extends BlocBase<S>, S extends Object>({
  1. required BlocWidgetListener<S> listener,
  2. required BlocWidgetBuilder<S> builder,
  3. Key? key,
  4. B? bloc,
  5. BlocListenerCondition<S>? listenWhen,
  6. BlocBuilderCondition<S>? buildWhen,
})

The BlocConsumer constuctor listen and rebuilds a widget when a bloc state change.

Implementation

const BlocConsumer({
  required BlocWidgetListener<S> listener,
  required this.builder,
  Key? key,

  /// The [bloc] that the [BlocConsumer] will interact with.
  /// If omitted, [BlocConsumer] will automatically perform a lookup using
  /// `BlocProvider` and the current `BuildContext`.
  B? bloc,
  BlocListenerCondition<S>? listenWhen,
  this.buildWhen,
}) : super(
        key: key,
        bloc: bloc,
        listenWhen: listenWhen,
        listener: listener,
      );