StreamBuilder<T> constructor

const StreamBuilder<T>(
  1. Stream<T> stream, {
  2. required Widget onData(
    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 StreamBuilder with some commonly used f.StreamBuilder parameters.

The widget returned by onData will be displayed when the connection state is not f.ConnectionState.waiting. 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 StreamBuilder(
  this.stream, {
  required this.onData,
  this.initialData,
  this.onError = _onErrorDefault,
  this.indicator = const f.Center(child: f.CircularProgressIndicator()),
});