Single<T>.fromFuture constructor

Single<T>.fromFuture(
  1. Future<T> future
)

Creates a new single-subscription Single from the future.

When the future completes, the Single will fire one event, either data or error, and then close with a done-event.

Marble

future: ----------a|
result: ----------a|

future: ----------x|
result: ----------x|

NOTE: x is error event

See also Single.fromCallable and Single.defer. These methods are useful for creating Singles that don't instantiate Futures until they are listened to.

Implementation

factory Single.fromFuture(Future<T> future) =>
    Single.safe(Stream.fromFuture(future));