Эта страница ещё не переведена, поэтому показана на английском. Помогите с переводом

skipWhile

Skips values while a predicate returns true, then yields everything after — matches or not.

Iterable<A> skipWhile<A>(bool Function(A a) f, Iterable<A> iterable) FxAsyncIterable<A> skipWhileAsync<A>(FutureOr<bool> Function(A a) f, FxAsyncIterable<A> iterable) Fx<T> Fx.skipWhile(bool Function(T a) f) // chain FxAsync<T> FxAsync.skipWhile(FutureOr<bool> Function(T a) f) Iterable<A> dropWhile<A>(...) // FxTS alias

Lecture

skipWhile is takeWhile's mirror: it skips elements as long as the predicate holds, then — the moment it hits one that fails — switches into "yield everything" mode for good. That switch-over is permanent: once skipWhile starts passing values through, it never goes back to dropping, even if a later element would also have matched.

Reach for it to strip a variable-length prefix you can't count in advance — leading whitespace-like tokens, header rows, a warm-up period in a metrics stream. skipWhile is the Dart-idiomatic name, matching Iterable.skipWhile; fxdart also accepts the FxTS spelling dropWhile — they're the same operator.

Demo 1 · Basics

Once dropping stops at 3, later matching values (2 at the end) are kept, not dropped again:

Demo 2 · Async

Try it yourself

Exercise: skip temperatures while they stay below 25, then keep the rest.

Related: takeWhile — the inverse · dropUntil — also drops the matching element · drop — drop by fixed count · filter — drop matches everywhere, not just a prefix