every method

Future<bool> every(bool test(T element))

Checks whether test accepts all elements provided by this stream.

Completes the Future when the answer is known. If this stream reports an error, the Future will report that error.

Source

Future<bool> every(bool test(T element)) {
  _Future<bool> future = new _Future<bool>();
  StreamSubscription subscription;
  subscription = this.listen(
      (T element) {
        _runUserCode(() => test(element), (bool isMatch) {
          if (!isMatch) {
            _cancelAndValue(subscription, future, false);
          }
        }, _cancelAndErrorClosure(subscription, future));
      },
      onError: future._completeError,
      onDone: () {
        future._complete(true);
      },
      cancelOnError: true);
  return future;
}

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/1.24.3/dart-async/Stream/every.html