FutureBuilder<T> constructor

const FutureBuilder<T>(
  1. Future<T> future, {
  2. required Widget onDone(
    1. BuildContext,
    2. T
    ),
  3. T? initialData,
  4. Widget onError(
    1. BuildContext,
    2. Object,
    3. StackTrace
    ) = _onErrorDefault,
  5. 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()),
});