typed<K, V> static method

  1. @Deprecated('Use map.cast<K, V> instead.')
Map<K, V> typed<K, V>(
  1. Map base
)

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

This soundly converts a Map without generic types to a Map<K, V> by asserting that its keys are instances of E and its values are instances of V 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 Map<K, V>, it's returned unmodified.

Implementation

@Deprecated('Use map.cast<K, V> instead.')
static Map<K, V> typed<K, V>(Map base) => base.cast<K, V>();