Movatterモバイル変換


[0]ホーム

URL:


menu
  1. Dart
  2. dart:async
  3. Stream<T>
  4. skipWhile method
skipWhile
description

skipWhile method

Stream<T>skipWhile(
  1. booltest(
    1. Telement
    )
)

Skip data events from this stream while they are matched bytest.

Returns a stream that emits the same events as this stream,except that data events are not emitted until a data event failstest.The test fails when called with a data eventif it returns a non-true value or if the call totest throws.If the call throws, the error is emitted as an error eventon the returned stream instead of the data event,otherwise the event that madetest return non-true is emitted as thefirst data event.

Error and done events are provided by the returned stream unmodified.

The returned stream is a broadcast stream if this stream is.For a broadcast stream, the events are only tested from the timethe returned stream is listened to.

Example:

final stream = Stream<int>.periodic(const Duration(seconds: 1), (i) => i)    .take(10)    .skipWhile((x) => x < 5);stream.forEach(print); // Outputs events: 5, ..., 9.

Implementation

Stream<T> skipWhile(bool test(T element)) {  return _SkipWhileStream<T>(this, test);}
  1. Dart
  2. dart:async
  3. Stream<T>
  4. skipWhile method
Stream class

[8]ページ先頭

©2009-2025 Movatter.jp