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;
}