typed<E> static method

  1. @Deprecated('Use iterable.cast<E> instead.')
Iterable<E> typed<E>(
  1. Iterable base
)

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 TypeError.

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>();