length property

Future<int> length

Counts the elements in the stream.

Source

Future<int> get length {
  _Future<int> future = new _Future<int>();
  int count = 0;
  this.listen(
      (_) {
        count++;
      },
      onError: future._completeError,
      onDone: () {
        future._complete(count);
      },
      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/length.html