FutureBuilder<T> constructor
const
FutureBuilder<T> (
- Future<
T> future, { - required Widget onDone(
- BuildContext,
- T
- T? initialData,
- Widget onError() = _onErrorDefault,
- Widget indicator = const f.Center(child: f.CircularProgressIndicator()),
Creates a FutureBuilder with some commonly used f.FutureBuilder parameters.
The widget returned by onDone
will be displayed when the connection
state is f.ConnectionState.done. The indicator
widget will be displayed
while the connection state is f.ConnectionState.waiting. If not provided,
a centered f.CircularProgressIndicator will be displayed. The widget
returned by onError
will be displayed when the future completes with an
error. If not provided, an f.ErrorWidget will be displayed.
Implementation
const FutureBuilder(
this.future, {
required this.onDone,
this.initialData,
this.onError = _onErrorDefault,
this.indicator = const f.Center(child: f.CircularProgressIndicator()),
});