AsyncBuilder<T> constructor

const AsyncBuilder<T>({
  1. Key? key,
  2. WidgetBuilder? waiting,
  3. required ValueBuilderFn<T> builder,
  4. ErrorBuilderFn? error,
  5. ValueBuilderFn<T>? closed,
  6. Future<T>? future,
  7. Stream<T>? stream,
  8. T? initial,
  9. bool retain = false,
  10. bool pause = false,
  11. bool? silent,
  12. bool keepAlive = false,
  13. ErrorReporterFn? reportError,
})

Creates a widget that builds depending on the state of a Future or Stream.

Implementation

const AsyncBuilder({
  Key? key,
  this.waiting,
  required this.builder,
  this.error,
  this.closed,
  this.future,
  this.stream,
  this.initial,
  this.retain = false,
  this.pause = false,
  bool? silent,
  this.keepAlive = false,
  ErrorReporterFn? reportError,
})  : silent = silent ?? error != null,
      reportError = reportError ?? FlutterError.reportError,
      assert(!((future != null) && (stream != null)),
          'AsyncBuilder should be given either a stream or future'),
      assert(future == null || closed == null,
          'AsyncBuilder should not be given both a future and closed builder'),
      super(key: key);