CanonicalizedMap<C, K, V> class

A map whose keys are converted to canonical values of type C.

This is useful for using case-insensitive String keys, for example. It's more efficient than a LinkedHashMap with a custom equality operator because it only canonicalizes each key once, rather than doing so for each comparison.

Implemented types
Available extensions

Constructors

CanonicalizedMap(C canonicalize(K key), {bool isValidKey(K key)?})
Creates an empty canonicalized map.
CanonicalizedMap.from(Map<K, V> other, C canonicalize(K key), {bool isValidKey(K key)?})
Creates a canonicalized map that is initialized with the key/value pairs of other.
CanonicalizedMap.fromEntries(Iterable<MapEntry<K, V>> entries, C canonicalize(K key), {bool isValidKey(K key)?})
Creates a canonicalized map that is initialized with the key/value pairs of entries.

Properties

$ Signal<Map<K, V>>

Available on Map<K, V>, provided by the SignalMapExtensions extension

Return a signal from a Map value
no setter
beautifiedJson String

Available on Map<String, dynamic>, provided by the BeautifiedJson extension

Returns a beautified JSON string representation.
no setter
encodedJsonString String

Available on Map<String, dynamic>, provided by the BeautifiedJsonMapExtension extension

no setter
encodeWithIndent String

Available on Map<K, V>, provided by the JsonMapX extension

Convenience getter used by ConversionException.toString().
no setter
entries Iterable<MapEntry<K, V>>
The map entries of this Map.
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
isEmpty bool
Whether there is no key/value pair in the map.
no setteroverride
isEmptyOrNull bool

Available on Map<K, V>?, provided by the DHUMapNullableExtension extension

Returns true when the map is null or empty.
no setter
isNotEmpty bool
Whether there is at least one key/value pair in the map.
no setteroverride
isNotEmptyOrNull bool

Available on Map<K, V>?, provided by the DHUMapNullableExtension extension

Returns true when the map is non-null and not empty.
no setter
keys Iterable<K>
The keys of this Map.
no setteroverride
keysList List<K>

Available on Map<K, V>, provided by the MapConversionX extension

Returns a list containing all the keys in the map.
no setter
keysSet Set<K>

Available on Map<K, V>, provided by the MapConversionX extension

Returns a set containing all the keys in the map.
no setter
length int
The number of key/value pairs in the map.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
values Iterable<V>
The values of this Map.
no setteroverride
valuesList List<V>

Available on Map<K, V>, provided by the MapConversionX extension

Returns a list containing all the values in the map.
no setter
valuesSet Set<V>

Available on Map<K, V>, provided by the MapConversionX extension

Returns a set containing all the values in the map.
no setter

Methods

addAll(Map<K, V> other) → void
Adds all key/value pairs of other to this map.
override
addEntries(Iterable<MapEntry<K, V>> entries) → void
Adds all key/value pairs of newEntries to this map.
override
cast<K2, V2>() Map<K2, V2>
Provides a view of this map as having RK keys and RV instances, if necessary.
override
clear() → void
Removes all entries from the map.
override
containsKey(Object? key) bool
Whether this map contains the given key.
override
containsValue(Object? value) bool
Whether this map contains the given value.
override
convertMapToList() List

Available on Map, provided by the OnMapExtensions extension

copy() CanonicalizedMap<C, K, V>
Copies this CanonicalizedMap instance without recalculating the canonical values of the keys.
deepMerge(Map<String, Object?> other) Map<String, Object?>

Available on Map<K, V>, provided by the DHUMapExt extension

Deep merges this map with other and returns a new map.
elementAtIntIndex(int index) → V

Available on Map<K, V>, provided by the GetByKeyIndex extension

Returns the value at the given zero-based index in iteration order. Throws if the index is out of range.
filter(bool predicate(K key, V value)) Map<K, V>

Available on Map<K, V>, provided by the DHUMapExtension extension

Filters the map, retaining only entries that satisfy the given predicate.
filterKeys(bool test(K key)) Map<K, V>

Available on Map<K, V>, provided by the MapTransformExtensions extension

Keeps only entries with keys satisfying test.
filterValues(bool test(V value)) Map<K, V>

Available on Map<K, V>, provided by the MapTransformExtensions extension

Keeps only entries with values satisfying test.
flatMap({String delimiter = '.', bool excludeArrays = false}) Map<String, Object?>

Available on Map<K, V>, provided by the DHUMapExt extension

Flattens a nested map into a single-level map.
forEach(void f(K, V)) → void
Applies action to each key/value pair of the map.
override
getBigInt(K key, {List<K>? alternativeKeys, dynamic innerKey, int? innerListIndex, BigInt? defaultValue, ElementConverter<BigInt>? converter}) BigInt

Available on Map<K, V>, provided by the MapConversionX extension

Converts the value at key (or alternativeKeys) to BigInt.
getBool(K key, {List<K>? alternativeKeys, dynamic innerKey, int? innerListIndex, bool? defaultValue, ElementConverter<bool>? converter}) bool

Available on Map<K, V>, provided by the MapConversionX extension

Converts the value at key (or alternativeKeys) to bool.
getBoolOrNull(Object? key) bool?

Available on Map<K, V>, provided by the MapTransformExtensions extension

getDateTime(K key, {List<K>? alternativeKeys, dynamic innerKey, int? innerListIndex, String? format, String? locale, bool autoDetectFormat = false, bool useCurrentLocale = false, bool utc = false, DateTime? defaultValue, ElementConverter<DateTime>? converter}) DateTime

Available on Map<K, V>, provided by the MapConversionX extension

Converts the value at key (or alternativeKeys) to DateTime.
getDouble(K key, {List<K>? alternativeKeys, dynamic innerKey, int? innerListIndex, double? defaultValue, String? format, String? locale, ElementConverter<double>? converter}) double

Available on Map<K, V>, provided by the MapConversionX extension

Converts the value at key (or alternativeKeys) to double.
getDoubleOrNull(Object? key) double?

Available on Map<K, V>, provided by the MapTransformExtensions extension

getEnum<T extends Enum>(K key, {required T parser(dynamic), List<K>? alternativeKeys, dynamic innerKey, int? innerListIndex, T? defaultValue, Map<String, dynamic>? debugInfo}) → T

Available on Map<K, V>, provided by the MapConversionX extension

Converts the value at key (or alternativeKeys) to an enum using parser.
getInt(K key, {List<K>? alternativeKeys, dynamic innerKey, int? innerListIndex, int? defaultValue, String? format, String? locale, ElementConverter<int>? converter}) int

Available on Map<K, V>, provided by the MapConversionX extension

Converts the value at key (or alternativeKeys) to int.
getIntOrNull(Object? key) int?

Available on Map<K, V>, provided by the MapTransformExtensions extension

getList<T>(K key, {List<K>? alternativeKeys, dynamic innerKey, int? innerListIndex, List<T>? defaultValue, ElementConverter<T>? elementConverter}) List<T>

Available on Map<K, V>, provided by the MapConversionX extension

Converts the value at key (or alternativeKeys) to a List of T.
getMap<K2, V2>(K key, {List<K>? alternativeKeys, dynamic innerKey, int? innerListIndex, Map<K2, V2>? defaultValue, ElementConverter<K2>? keyConverter, ElementConverter<V2>? valueConverter}) Map<K2, V2>

Available on Map<K, V>, provided by the MapConversionX extension

Converts the value at key (or alternativeKeys) to a Map of K2 to V2.
getNum(K key, {List<K>? alternativeKeys, dynamic innerKey, int? innerListIndex, num? defaultValue, String? format, String? locale, ElementConverter<num>? converter}) num

Available on Map<K, V>, provided by the MapConversionX extension

Converts the value at key (or alternativeKeys) to num.
getPath(String path, {String delimiter = '.', bool parseIndices = true}) Object?

Available on Map<K, V>, provided by the DHUMapExt extension

Reads a value from a nested map using path (e.g., "a.b.c").
getSet<T>(K key, {List<K>? alternativeKeys, dynamic innerKey, int? innerListIndex, Set<T>? defaultValue, ElementConverter<T>? elementConverter}) Set<T>

Available on Map<K, V>, provided by the MapConversionX extension

Converts the value at key (or alternativeKeys) to a Set of T.
getString(K key, {List<K>? alternativeKeys, dynamic innerKey, int? innerListIndex, String? defaultValue, ElementConverter<String>? converter}) String

Available on Map<K, V>, provided by the MapConversionX extension

Converts the value at key (or alternativeKeys) to String.
getString(Object? key) String?

Available on Map<K, V>, provided by the MapTransformExtensions extension

getUri(K key, {List<K>? alternativeKeys, dynamic innerKey, int? innerListIndex, Uri? defaultValue, ElementConverter<Uri>? converter}) Uri

Available on Map<K, V>, provided by the MapConversionX extension

Converts the value at key (or alternativeKeys) to Uri.
inj({bool autoDisposeWhenNotUsed = true}) ReactiveModel<Map<T, D>>

Available on Map<T, D>, provided by the MapX extension

create a ReactiveModel state
intlSelect(Object choice, {String? desc, Map<String, Object>? examples, String? locale, String? name, List<Object>? args, String? meaning, bool? skip}) String

Available on Map<Object, String>, provided by the IntlMapStringExtension extension

Format a message differently depending on choice.
intlSelectLogic(Object choice) → T

Available on Map<Object, T>, provided by the IntlMapExtension extension

Internal: Implements the logic for select - use intlSelect for normal messages.
isPrimitive() bool

Available on Map<K, V>?, provided by the DHUMapNullableExtension extension

Returns true when every key and value is a primitive value.
joinWithMap(String separator, {String keyValueSeparator = '='}) String

Available on Map<String, dynamic>, provided by the MapExt extension

keysWhere(bool condition(V)) Iterable<K>

Available on Map<K, V>, provided by the DHUMapExtension extension

Returns an iterable of keys where the associated values satisfy the given condition.
map<K2, V2>(MapEntry<K2, V2> transform(K, V)) Map<K2, V2>
Returns a new map where all entries of this map are transformed by the given convert function.
override
mapKeys<K2>(K2 transform(K key, V value)) Map<K2, V>

Available on Map<K, V>, provided by the MapTransformExtensions extension

Returns a new map with transformed keys.
mapValues<V2>(V2 transform(V)) Map<K, V2>

Available on Map<K, V>, provided by the DHUMapExtension extension

Transforms the values in this map using the given function.
mapValues<V2>(V2 transform(K key, V value)) Map<K, V2>

Available on Map<K, V>, provided by the MapTransformExtensions extension

Returns a new map with transformed values.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parse<T, K2, V2>(K key, T converter(Map<K2, V2> json)) → T

Available on Map<K, V>, provided by the MapConversionX extension

Parses the nested map at key using the provided converter.
putIfAbsent(K key, V ifAbsent()) → V
Look up the value of key, or add a new entry if it isn't there.
override
remove(Object? key) → V?
Removes key and its associated value, if present, from the map.
override
removeWhere(bool test(K key, V value)) → void
Removes all entries of this map that satisfy the given test.
override
retype<K2, V2>() Map<K2, V2>
setIfMissing(K key, V value) → V

Available on Map<K, V>, provided by the DHUMapExtension extension

Inserts a key-value pair into the map if the key does not already exist.
setPath(String path, Object? value, {String delimiter = '.', bool parseIndices = true}) bool

Available on Map<K, V>, provided by the DHUMapExt extension

Writes a value into a nested map using path (e.g., "a.b.c").
swapKeysWithValues() Map<V, K>

Available on Map<K, V>, provided by the DHUMapExtension extension

Swaps the keys with values in the map. Note: If there are duplicate values, the last key-value pair will be kept.
toJson() String

Available on Map<String, TimeOfDay>, provided by the MapStringTimeOfDayJsonExtension extension

toJsonMap({JsonOptions options = const JsonOptions(), Object? toEncodable(dynamic object)?}) Map<String, dynamic>

Available on Map<K, V>, provided by the JsonMapX extension

Converts this map to a Map<String, dynamic> with JSON-encodable values.
toJsonString({String? indent, JsonOptions options = const JsonOptions(), Object? toEncodable(dynamic object)?}) String

Available on Map<K, V>, provided by the JsonMapX extension

Converts this map to a JSON string (pretty if indent is provided).
toMap() Map<K, V>
Creates a Map<K,V> (with the original key values). See toMapOfCanonicalKeys.
toMapOfCanonicalKeys() Map<C, V>
Creates a Map<C,V> (with the canonicalized keys). See toMap.
toSignal({String? debugLabel, bool autoDispose = false}) MapSignal<K, V>

Available on Map<K, V>, provided by the SignalMapUtils extension

Convert an existing list to MapSignal
toString() String
A string representation of this object.
override
tryGetBigInt(K key, {List<K>? alternativeKeys, dynamic innerKey, int? innerListIndex, BigInt? defaultValue, ElementConverter<BigInt>? converter}) BigInt?

Available on Map<K, V>?, provided by the NullableMapConversionX extension

Tries to convert the value at key (or alternativeKeys) to BigInt.
tryGetBool(K key, {List<K>? alternativeKeys, dynamic innerKey, int? innerListIndex, bool? defaultValue, ElementConverter<bool>? converter}) bool?

Available on Map<K, V>?, provided by the NullableMapConversionX extension

Tries to convert the value at key (or alternativeKeys) to bool.
tryGetDateTime(K key, {List<K>? alternativeKeys, dynamic innerKey, int? innerListIndex, String? format, String? locale, bool autoDetectFormat = false, bool useCurrentLocale = false, bool utc = false, DateTime? defaultValue, ElementConverter<DateTime>? converter}) DateTime?

Available on Map<K, V>?, provided by the NullableMapConversionX extension

Tries to convert the value at key (or alternativeKeys) to DateTime.
tryGetDouble(K key, {List<K>? alternativeKeys, dynamic innerKey, int? innerListIndex, double? defaultValue, String? format, String? locale, ElementConverter<double>? converter}) double?

Available on Map<K, V>?, provided by the NullableMapConversionX extension

Tries to convert the value at key (or alternativeKeys) to double.
tryGetEnum<T extends Enum>(K key, {required T parser(dynamic), List<K>? alternativeKeys, dynamic innerKey, int? innerListIndex, T? defaultValue, Map<String, dynamic>? debugInfo}) → T?

Available on Map<K, V>?, provided by the NullableMapConversionX extension

Tries to convert the value at key (or alternativeKeys) to an enum using parser.
tryGetInt(K key, {List<K>? alternativeKeys, dynamic innerKey, int? innerListIndex, int? defaultValue, String? format, String? locale, ElementConverter<int>? converter}) int?

Available on Map<K, V>?, provided by the NullableMapConversionX extension

Tries to convert the value at key (or alternativeKeys) to int.
tryGetList<T>(K key, {List<K>? alternativeKeys, dynamic innerKey, int? innerListIndex, List<T>? defaultValue, ElementConverter<T>? elementConverter}) List<T>?

Available on Map<K, V>?, provided by the NullableMapConversionX extension

Tries to convert the value at key (or alternativeKeys) to a List of T.
tryGetMap<K2, V2>(K key, {List<K>? alternativeKeys, dynamic innerKey, int? innerListIndex, Map<K2, V2>? defaultValue, ElementConverter<K2>? keyConverter, ElementConverter<V2>? valueConverter}) Map<K2, V2>?

Available on Map<K, V>?, provided by the NullableMapConversionX extension

Tries to convert the value at key (or alternativeKeys) to a Map of K2 to V2.
tryGetNum(K key, {List<K>? alternativeKeys, dynamic innerKey, int? innerListIndex, num? defaultValue, String? format, String? locale, ElementConverter<num>? converter}) num?

Available on Map<K, V>?, provided by the NullableMapConversionX extension

Tries to convert the value at key (or alternativeKeys) to num.
tryGetSet<T>(K key, {List<K>? alternativeKeys, dynamic innerKey, int? innerListIndex, Set<T>? defaultValue, ElementConverter<T>? elementConverter}) Set<T>?

Available on Map<K, V>?, provided by the NullableMapConversionX extension

Tries to convert the value at key (or alternativeKeys) to a Set of T.
tryGetString(K key, {List<K>? alternativeKeys, dynamic innerKey, int? innerListIndex, String? defaultValue, ElementConverter<String>? converter}) String?

Available on Map<K, V>?, provided by the NullableMapConversionX extension

Tries to convert the value at key (or alternativeKeys) to String.
tryGetUri(K key, {List<K>? alternativeKeys, dynamic innerKey, int? innerListIndex, Uri? defaultValue, ElementConverter<Uri>? converter}) Uri?

Available on Map<K, V>?, provided by the NullableMapConversionX extension

Tries to convert the value at key (or alternativeKeys) to Uri.
tryParse<T, K2, V2>(K key, T converter(Map<K2, V2> json)) → T?

Available on Map<K, V>, provided by the MapConversionX extension

Tries to parse the nested map at key using the provided converter.
unflatten({String delimiter = '.', bool parseIndices = true}) Map<String, Object?>

Available on Map<K, V>, provided by the DHUMapExt extension

Rebuilds a nested map from a flattened map.
update(K key, V update(V), {V ifAbsent()?}) → V
Updates the value for the provided key.
override
updateAll(V update(K key, V value)) → void
Updates all values.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited
operator [](Object? key) → V?
The value for the given key, or null if key is not in the map.
override
operator []=(K key, V value) → void
Associates the key with the given value.
override