next method

Future<List<int>> next()

Implementation

Future<List<int>> next() {
  if (_npack == 0) {
    if (done) {
      return Future<List<int>>.error("stream closed");
    }
    _nfut += 1;
    _queue.addLast(Completer<List<int>>());
    return _queue.last.future;
  } else {
    Completer<List<int>> c = _queue.removeFirst();
    _npack -= 1;
    return c.future;
  }
}