firstNonNull property

  1. @override
Future<T> get firstNonNull
override

Blocks until value is non-null, and then completes with that value.

If value is already non-null, completes immediately.

The implementation may internally subscribe to stream, so if stream is single-subscription (non-broadcast), it won't be possible to listen to it separately.

Implementation

@override
Future<T> get firstNonNull => value != null
    ? Future.value(value)
    : stream.firstWhere((value) => value != null);