castFrom method - Iterable class - dart:core library (original) (raw)

description

castFrom<S, T> static method

Iterable<T> castFrom<S, T>(

  1. Iterable<S> source )

Adapts source to be an Iterable<T>.

Any time the iterable would produce an element that is not a T, the element access will throw. If all elements of source are actually instances of T, or if only elements that are actually instances of Tare accessed, then the resulting iterable can be used as an Iterable<T>.

Implementation

static Iterable<T> castFrom<S, T>(Iterable<S> source) =>
    CastIterable<S, T>(source);