KtMap<K, V> class

A collection that holds pairs of objects (keys and values) and supports efficiently retrieving the value corresponding to each key. Map keys are unique; the map holds only one value for each key. Methods in this interface support only read-only access to the map; read-write access is supported through the KtMutableMap interface. @param K the type of map keys. The map is invariant on its key type, as it can accept key as a parameter (of containsKey for example) and return it in keys set. @param V the type of map values. The map is covariant on its value type.

Implementers
Available Extensions

Constructors

KtMap.empty()
const
factory
KtMap.from([@nonNull Map<K, V> map = const {}])
factory

Properties

entries KtSet<KtMapEntry<K, V>>
Returns a read-only KtSet of all key/value pairs in this map.
read-only
hashCode int
The hash code for this object. [...]
read-only, inherited
iter Iterable<KtMapEntry<K, V>>
Access to a Iterable to be used in for-loops
read-only
keys KtSet<K>
Returns a read-only KtSet of all keys in this map.
read-only
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
size int
Returns the number of key/value pairs in the map.
read-only
values KtCollection<V>
Returns a read-only KtCollection of all values in this map. Note that this collection may contain duplicate values.
read-only

Methods

asMap() Map<K, V>
Returns a read-only dart:core Map [...]
containsKey(K key) bool
Returns true if the map contains the specified key.
containsValue(V value) bool
Returns true if the map maps one or more keys to the specified value.
get(K key) → V
Returns the value corresponding to the given key, or null if such a key is not present in the map.
getOrDefault(K key, V defaultValue) → V
Returns the value corresponding to the given key, or defaultValue if such a key is not present in the map.
isEmpty() bool
Returns true if the map is empty (contains no elements), false otherwise.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() String
Returns a string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited
operator [](K key) → V
Returns the value corresponding to the given key, or null if such a key is not present in the map.