takeWhileInclusive method

Stream<T> takeWhileInclusive(
  1. bool predicate(
    1. T
    )
)

Emits events only while predicate holds; closes the stream on first failure.

Implementation

Stream<T> takeWhileInclusive(bool Function(T) predicate) async* {
  await for (final value in this) {
    yield value;
    if (!predicate(value)) break;
  }
}