single<A> static method
AsyncValueBuilder
single<A>(
- AsyncValue<
A> asyncValue, { - Key? key,
- required Widget onData(
- BuildContext context,
- A data
- Widget builder(
- BuildContext context,
- Widget child,
- A? data
- ErrorBuilder? onError,
- WidgetBuilder? onLoading,
- WidgetBuilder? orElse,
Implementation
static AsyncValueBuilder single<A>(
AsyncValue<A> asyncValue, {
Key? key,
required Widget Function(BuildContext context, A data) onData,
Widget Function(BuildContext context, Widget child, A? data)? builder,
ErrorBuilder? onError,
WidgetBuilder? onLoading,
WidgetBuilder? orElse,
}) =>
AsyncValueBuilder._(
key: key,
asyncValues: [asyncValue],
onData: (context, data) => onData(context, data[0] as A),
builder: (context, child, data) => builder != null
? builder.call(
context,
child,
data[0] as A?,
)
: child,
onError: onError,
onLoading: onLoading,
orElse: orElse,
);