takeWhileInclusive method

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

Emits values emitted by the source Stream so long as each value satisfies the given test. When the test is not satisfied by a value, it will emit this value as a final event and then complete.

Example

Stream.fromIterable([2, 3, 4, 5, 6, 1, 2, 3])
  .takeWhileInclusive((i) => i < 4)
  .listen(print); // prints 2, 3, 4

Implementation

Stream<T> takeWhileInclusive(bool Function(T) test) =>
    TakeWhileInclusiveStreamTransformer<T>(test).bind(this);