FuturesStream constructor

FuturesStream(
  1. List<FutureOr> futures
)

Implementation

FuturesStream(this.futures) : _result = List.filled(futures.length, null) {
  for (var i = 0; i < futures.length; ++i) {
    var f = futures[i];
    f.thenOr((r) {
      _result[i] = r;
      _resolved += 1;
      _stream.add([..._result]);
      if (_resolved == futures.length) {
        _stream.close();
      }
    });
  }
}