single<A> static method
AsyncBuilder
single<A>(
- Future<
A> snapshot, { - 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 AsyncBuilder single<A>(
Future<A> snapshot, {
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,
}) =>
AsyncBuilder._(
key: key,
snapshots: [snapshot],
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,
);