ofFuture<T> static method

ControlObservable<T?> ofFuture<T>(
  1. Future<T> future
)

Creates an observable from given future. Future value is propagated to this observable. This object waits to future completion and then sets value. If error occurs nothing happens.

Implementation

static ControlObservable<T?> ofFuture<T>(Future<T> future) {
  final observable = ControlObservable<T?>(null);

  future.then((value) => observable.setValue(value)).catchError((err) {
    printDebug(err);
  });

  return observable;
}