W3cubDocs

/Dart 2

castFrom<S, T> method

Iterable<T> castFrom <S, T>(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 T are 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);

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.5.0/dart-core/Iterable/castFrom.html