QueryResultBuilder<T> constructor
QueryResultBuilder<T> ({
- Key? key,
- required AsyncQueryResult<
T> result, - Widget? child,
- required TransitionBuilder? idleBuilder,
- ValueWidgetBuilder<
T> ? presetBuilder, - required TransitionBuilder workingBuilder,
- required ValueWidgetBuilder<
Object> failedBuilder, - required ValueWidgetBuilder<
T> succeededBuilder,
Consume AsyncQueryResult
idleBuilder
- Builder to be used when AsyncQueryResult.idle is given.presetBuilder
- Optional builder to be used AsyncQueryResult.preset is given.workingBuilder
- Builder to be used when AsyncQueryResult.working is given.failedBuilder
- Builder to be used when AsyncQueryResult.failed is given.succeededBuilder
- Builder to be used when AsyncQueryResult.succeeded is given.
To consume ActionResult, use ActionResultBuilder.sync.
Implementation
QueryResultBuilder({
Key? key,
required AsyncQueryResult<T> result,
Widget? child,
required TransitionBuilder? idleBuilder,
ValueWidgetBuilder<T>? presetBuilder,
required TransitionBuilder workingBuilder,
required ValueWidgetBuilder<Object> failedBuilder,
required ValueWidgetBuilder<T> succeededBuilder,
}) : super(
key: key,
stated: result,
child: child,
patternDefs: (b) => b
..unit(
OnState<IdleState>(),
idleBuilder ?? workingBuilder,
)
..value(
OnState<IdleValueState>(),
presetBuilder ?? succeededBuilder,
)
..unit(OnState.isWorking(), workingBuilder)
..error(OnState.isFailed(), failedBuilder)
..value(OnState.isSuceeded(), succeededBuilder),
);