# Stream<T>.fromIterable constructor

Stream<T>.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.

## Implementation

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