toStream<T> method

Stream<T> toStream<T>()

Implementation

Stream<T> toStream<T>() async* {
  final iterator = js_util.getProperty(this, _asyncIterator);
  final callable = js_util.callMethod(iterator, 'call', []);

  while (true) {
    final result = await _next<T>(callable);
    if (result.done) {
      break;
    }
    yield result.value;
  }
}