typed<E> static method

  1. @Deprecated('Use queue.cast<E> instead.')
Queue<E> typed<E>(
  1. Queue base
)

Creates a wrapper that asserts the types of values in base.

This soundly converts a Queue without a generic type to a Queue<E> by asserting that its elements are instances of E whenever they're accessed. If they're not, it throws a TypeError. Note that even if an operation throws a TypeError, it may still mutate the underlying collection.

This forwards all operations to base, so any changes in base will be reflected in this. If base is already a Queue<E>, it's returned unmodified.

Implementation

@Deprecated('Use queue.cast<E> instead.')
static Queue<E> typed<E>(Queue base) => base.cast<E>();