typed<E> method
Null safety
- @Deprecated('Use iterable.cast<E> instead.')
- Iterable base
Deprecated('Use iterable.cast<E> instead.')">@Deprecated('Use iterable.cast<E> instead.')
Creates a wrapper that asserts the types of values in base
.
This soundly converts an Iterable without a generic type to an
Iterable<E>
by asserting that its elements are instances of E
whenever
they're accessed. If they're not, it throws a CastError.
This forwards all operations to base
, so any changes in base
will be
reflected in this. If base
is already an Iterable<E>
, it's returned
unmodified.
Implementation
@Deprecated('Use iterable.cast<E> instead.')
static Iterable<E> typed<E>(Iterable base) => base.cast<E>();