defaultIfEmpty method

Stream<T> defaultIfEmpty(
  1. T defaultValue
)

Emit items from the source Stream, or a single default item if the source Stream emits nothing.

Example

Stream.empty().defaultIfEmpty(10).listen(print); // prints 10

Implementation

Stream<T> defaultIfEmpty(T defaultValue) =>
    DefaultIfEmptyStreamTransformer<T>(defaultValue).bind(this);