ActionBlocConsumer<B extends BlocBase<AsyncActionResult>> constructor

ActionBlocConsumer<B extends BlocBase<AsyncActionResult>>({
  1. Key? key,
  2. B? bloc,
  3. Widget? child,
  4. required TransitionBuilder? idleBuilder,
  5. required TransitionBuilder workingBuilder,
  6. required ValueWidgetBuilder<Object> failedBuilder,
  7. required TransitionBuilder suceededBuilder,
  8. BlocBuilderCondition<AsyncActionResult>? buildWhen,
  9. ContextConsumer? idleConsumer,
  10. ContextConsumer? workingConsumer,
  11. ValueConsumer<Object>? failedConsumer,
  12. ContextConsumer? succeededConsumer,
  13. BlocBuilderCondition<AsyncActionResult>? listenWhen,
})

Implementation

ActionBlocConsumer({
  Key? key,
  B? bloc,
  Widget? child,
  required TransitionBuilder? idleBuilder,
  required TransitionBuilder workingBuilder,
  required ValueWidgetBuilder<Object> failedBuilder,
  required TransitionBuilder suceededBuilder,
  BlocBuilderCondition<AsyncActionResult>? buildWhen,
  ContextConsumer? idleConsumer,
  ContextConsumer? workingConsumer,
  ValueConsumer<Object>? failedConsumer,
  ContextConsumer? succeededConsumer,
  BlocBuilderCondition<AsyncActionResult>? listenWhen,
}) : super(
        key: key,
        bloc: bloc,
        builder: (context, result) => ActionResultBuilder(
          result: result,
          child: child,
          idleBuilder: idleBuilder ?? workingBuilder,
          workingBuilder: workingBuilder,
          failedBuilder: failedBuilder,
          succeededBuilder: suceededBuilder,
        ),
        buildWhen: buildWhen,
        listener: StatedConsumer((b) => b
          ..unit(OnState.isIdle(), idleConsumer)
          ..unit(OnState.isWorking(), workingConsumer)
          ..error(OnState.isFailed(), failedConsumer)
          ..unit(OnState.isSuceeded(), succeededConsumer)),
        listenWhen: listenWhen,
      );