typed<E> method

  1. @Deprecated('Use iterable.cast<E> instead.')
Iterable<E> typed <E>(
  1. Iterable base
)
@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>();