OnBuilder<T>.createFuture constructor

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

Create a ReactiveModel state from a future and listen to it

Implementation

OnBuilder.createFuture({
  Key? key,
  required Future<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,
      );