OnBuilder<T>.createStream constructor

OnBuilder<T>.createStream({
  1. Key? key,
  2. required Stream<T> creator(),
  3. T? initialState,
  4. SideEffects<T>? sideEffects,
  5. required Widget builder(
    1. ReactiveModel<T> rm
    ),
})

Create a ReactiveModel state from a stream and listen to it

Implementation

OnBuilder.createStream({
  Key? key,
  required Stream<T> Function() creator,
  T? initialState,
  SideEffects<T>? sideEffects,
  required Widget Function(ReactiveModel<T> rm) builder,
}) : super(
        key: key,
        observers: (_) => [
          ReactiveModel<T>.create(
            creator: creator,
            initialState: initialState,
            autoDisposeWhenNotUsed: true,
          ) as ReactiveModelImp
        ],
        builder: (_, __, rm) => builder(rm),
        sideEffects: sideEffects,
      );