QueryBlocConsumer<B extends BlocBase<AsyncQueryResult<T> > , T> constructor
QueryBlocConsumer<B extends BlocBase<AsyncQueryResult<T> > , T> ({
- Key? key,
- B? bloc,
- Widget? child,
- required TransitionBuilder? idleBuilder,
- ValueWidgetBuilder<
T> ? presetBuilder, - required TransitionBuilder workingBuilder,
- required ValueWidgetBuilder<
Object> failedBuilder, - required ValueWidgetBuilder<
T> succeededBuilder, - BlocBuilderCondition<
AsyncQueryResult< ? buildWhen,T> > - ContextConsumer? idleConsumer,
- ValueConsumer<
T> ? presetConsumer, - ContextConsumer? workingConsumer,
- ValueConsumer<
Object> ? failedConsumer, - ValueConsumer<
T> ? succeededConsumer, - BlocBuilderCondition<
AsyncQueryResult< ? listenWhen,T> >
Implementation
QueryBlocConsumer({
Key? key,
B? bloc,
Widget? child,
required TransitionBuilder? idleBuilder,
ValueWidgetBuilder<T>? presetBuilder,
required TransitionBuilder workingBuilder,
required ValueWidgetBuilder<Object> failedBuilder,
required ValueWidgetBuilder<T> succeededBuilder,
BlocBuilderCondition<AsyncQueryResult<T>>? buildWhen,
ContextConsumer? idleConsumer,
ValueConsumer<T>? presetConsumer,
ContextConsumer? workingConsumer,
ValueConsumer<Object>? failedConsumer,
ValueConsumer<T>? succeededConsumer,
BlocBuilderCondition<AsyncQueryResult<T>>? listenWhen,
}) : super(
key: key,
bloc: bloc,
builder: (context, result) => QueryResultBuilder<T>(
result: result,
child: child,
idleBuilder: idleBuilder ?? workingBuilder,
presetBuilder: presetBuilder ?? succeededBuilder,
workingBuilder: workingBuilder,
failedBuilder: failedBuilder,
succeededBuilder: succeededBuilder,
),
buildWhen: buildWhen,
listener: StatedConsumer((b) => b
..unit(OnState<IdleState>(), idleConsumer)
..value(OnState<IdleValueState>(), presetConsumer)
..unit(OnState.isWorking(), workingConsumer)
..error(OnState.isFailed(), failedConsumer)
..value(OnState.isSuceeded(), succeededConsumer)),
listenWhen: listenWhen,
);