stream<T> static method

Widget stream<T>(
  1. Reactive<T> reactive,
  2. AsyncWidgetBuilder<T> builder, {
  3. Key? key,
  4. bool withInitial = true,
})

Builds a StreamBuilder wired to the reactive stream.

This is useful when you want direct access to the AsyncSnapshot produced by Flutter's stream widgets.

When withInitial is true, the current reactive value is passed to StreamBuilder.initialData.

Implementation

static Widget stream<T>(
  Reactive<T> reactive,
  AsyncWidgetBuilder<T> builder, {
  Key? key,
  bool withInitial = true,
}) {
  return StreamBuilder<T>(
    key: key,
    stream: reactive.stream,
    initialData: withInitial ? reactive.value : null,
    builder: builder,
  );
}