Stream.fromIterable factory constructor

Stream.fromIterable(Iterable<T> data)

Creates a single-subscription stream that gets its data from data.

The iterable is iterated when the stream receives a listener, and stops iterating if the listener cancels the subscription.

If iterating data throws an error, the stream ends immediately with that error. No done event will be sent (iteration is not complete), but no further data events will be generated either, since iteration cannot continue.

Source

factory Stream.fromIterable(Iterable<T> data) {
  return new _GeneratedStreamImpl<T>(
      () => new _IterablePendingEvents<T>(data));
}

© 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/Stream.fromIterable.html