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
-
- Map<
K, V>
- Map<
- Available extensions
- BeautifiedJson
- BeautifiedJsonMapExtension
- DHUMapExt
- DHUMapExtension
- DHUMapNullableExtension
- GetByKeyIndex
- IntlMapExtension
- IntlMapStringExtension
- JsonMapX
- MapConversionX
- MapExt
- MapStringTimeOfDayJsonExtension
- MapTransformExtensions
- MapX
- NullableMapConversionX
- OnMapExtensions
- SignalMapExtensions
- SignalMapUtils
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< entries, C canonicalize(K key), {bool isValidKey(K key)?})K, V> > -
Creates a canonicalized map that is initialized with the key/value pairs
of
entries.
Properties
-
$
→ Signal<
Map< K, V> > -
Available on Map<
Return a signal from a Map valueK, V> , provided by the SignalMapExtensions extensionno setter - beautifiedJson → String
-
Available on Map<
Returns a beautified JSON string representation.String, dynamic> , provided by the BeautifiedJson extensionno setter - encodedJsonString → String
-
Available on Map<
String, dynamic> , provided by the BeautifiedJsonMapExtension extensionno setter - encodeWithIndent → String
-
Available on Map<
Convenience getter used byK, V> , provided by the JsonMapX extensionConversionException.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<
ReturnsK, V> ?, provided by the DHUMapNullableExtension extensiontruewhen the map isnullor empty.no setter - isNotEmpty → bool
-
Whether there is at least one key/value pair in the map.
no setteroverride
- isNotEmptyOrNull → bool
-
Available on Map<
ReturnsK, V> ?, provided by the DHUMapNullableExtension extensiontruewhen 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<
Returns a list containing all the keys in the map.K, V> , provided by the MapConversionX extensionno setter -
keysSet
→ Set<
K> -
Available on Map<
Returns a set containing all the keys in the map.K, V> , provided by the MapConversionX extensionno 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<
Returns a list containing all the values in the map.K, V> , provided by the MapConversionX extensionno setter -
valuesSet
→ Set<
V> -
Available on Map<
Returns a set containing all the values in the map.K, V> , provided by the MapConversionX extensionno setter
Methods
-
addAll(
Map< K, V> other) → void -
Adds all key/value pairs of
otherto this map.override -
addEntries(
Iterable< MapEntry< entries) → voidK, V> > -
Adds all key/value pairs of
newEntriesto this map.override -
cast<
K2, V2> () → Map< K2, V2> -
Provides a view of this map as having
RKkeys andRVinstances, 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<
Deep merges this map withK, V> , provided by the DHUMapExt extensionotherand returns a new map. -
elementAtIntIndex(
int index) → V -
Available on Map<
Returns the value at the given zero-basedK, V> , provided by the GetByKeyIndex extensionindexin iteration order. Throws if the index is out of range. -
filter(
bool predicate(K key, V value)) → Map< K, V> -
Available on Map<
Filters the map, retaining only entries that satisfy the given predicate.K, V> , provided by the DHUMapExtension extension -
filterKeys(
bool test(K key)) → Map< K, V> -
Available on Map<
Keeps only entries with keys satisfyingK, V> , provided by the MapTransformExtensions extensiontest. -
filterValues(
bool test(V value)) → Map< K, V> -
Available on Map<
Keeps only entries with values satisfyingK, V> , provided by the MapTransformExtensions extensiontest. -
flatMap(
{String delimiter = '.', bool excludeArrays = false}) → Map< String, Object?> - Flattens a nested map into a single-level map.
-
forEach(
void f(K, V)) → void -
Applies
actionto 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<
Converts the value atK, V> , provided by the MapConversionX extensionkey(oralternativeKeys) to BigInt. -
getBool(
K key, {List< K> ? alternativeKeys, dynamic innerKey, int? innerListIndex, bool? defaultValue, ElementConverter<bool> ? converter}) → bool -
Available on Map<
Converts the value atK, V> , provided by the MapConversionX extensionkey(oralternativeKeys) 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<
Converts the value atK, V> , provided by the MapConversionX extensionkey(oralternativeKeys) 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<
Converts the value atK, V> , provided by the MapConversionX extensionkey(oralternativeKeys) 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<
Converts the value atK, V> , provided by the MapConversionX extensionkey(oralternativeKeys) to an enum usingparser. -
getInt(
K key, {List< K> ? alternativeKeys, dynamic innerKey, int? innerListIndex, int? defaultValue, String? format, String? locale, ElementConverter<int> ? converter}) → int -
Available on Map<
Converts the value atK, V> , provided by the MapConversionX extensionkey(oralternativeKeys) 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<
Converts the value atK, V> , provided by the MapConversionX extensionkey(oralternativeKeys) to a List ofT. -
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<
Converts the value atK, V> , provided by the MapConversionX extensionkey(oralternativeKeys) to a Map ofK2toV2. -
getNum(
K key, {List< K> ? alternativeKeys, dynamic innerKey, int? innerListIndex, num? defaultValue, String? format, String? locale, ElementConverter<num> ? converter}) → num -
Available on Map<
Converts the value atK, V> , provided by the MapConversionX extensionkey(oralternativeKeys) to num. -
getPath(
String path, {String delimiter = '.', bool parseIndices = true}) → Object? -
Available on Map<
Reads a value from a nested map usingK, V> , provided by the DHUMapExt extensionpath(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<
Converts the value atK, V> , provided by the MapConversionX extensionkey(oralternativeKeys) to a Set ofT. -
getString(
K key, {List< K> ? alternativeKeys, dynamic innerKey, int? innerListIndex, String? defaultValue, ElementConverter<String> ? converter}) → String -
Available on Map<
Converts the value atK, V> , provided by the MapConversionX extensionkey(oralternativeKeys) 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<
Converts the value atK, V> , provided by the MapConversionX extensionkey(oralternativeKeys) to Uri. -
inj(
{bool autoDisposeWhenNotUsed = true}) → ReactiveModel< Map< T, D> > -
Available on Map<
create a ReactiveModel stateT, D> , provided by the MapX extension -
intlSelect(
Object choice, {String? desc, Map< String, Object> ? examples, String? locale, String? name, List<Object> ? args, String? meaning, bool? skip}) → String -
Available on Map<
Format a message differently depending onObject, String> , provided by the IntlMapStringExtension extensionchoice. -
intlSelectLogic(
Object choice) → T -
Available on Map<
Internal: Implements the logic forObject, T> , provided by the IntlMapExtension extensionselect- useintlSelectfor normal messages. -
isPrimitive(
) → bool -
Available on Map<
ReturnsK, V> ?, provided by the DHUMapNullableExtension extensiontruewhen 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<
Returns an iterable of keys where the associated values satisfy the given condition.K, V> , provided by the DHUMapExtension extension -
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
convertfunction.override -
mapKeys<
K2> (K2 transform(K key, V value)) → Map< K2, V> -
Available on Map<
Returns a new map with transformed keys.K, V> , provided by the MapTransformExtensions extension -
mapValues<
V2> (V2 transform(V)) → Map< K, V2> -
Available on Map<
Transforms the values in this map using the given function.K, V> , provided by the DHUMapExtension extension -
mapValues<
V2> (V2 transform(K key, V value)) → Map< K, V2> -
Available on Map<
Returns a new map with transformed values.K, V> , provided by the MapTransformExtensions extension -
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<
Parses the nested map atK, V> , provided by the MapConversionX extensionkeyusing the providedconverter. -
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
keyand 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<
Inserts a key-value pair into the map if the key does not already exist.K, V> , provided by the DHUMapExtension extension -
setPath(
String path, Object? value, {String delimiter = '.', bool parseIndices = true}) → bool -
Available on Map<
Writes a value into a nested map usingK, V> , provided by the DHUMapExt extensionpath(e.g., "a.b.c"). -
swapKeysWithValues(
) → Map< V, K> -
Available on Map<
Swaps the keys with values in the map. Note: If there are duplicate values, the last key-value pair will be kept.K, V> , provided by the DHUMapExtension extension -
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<
Converts this map to aK, V> , provided by the JsonMapX extensionMap<String, dynamic>with JSON-encodable values. -
toJsonString(
{String? indent, JsonOptions options = const JsonOptions(), Object? toEncodable(dynamic object)?}) → String -
Available on Map<
Converts this map to a JSON string (pretty ifK, V> , provided by the JsonMapX extensionindentis 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<
Convert an existing list to MapSignalK, V> , provided by the SignalMapUtils extension -
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<
Tries to convert the value atK, V> ?, provided by the NullableMapConversionX extensionkey(oralternativeKeys) to BigInt. -
tryGetBool(
K key, {List< K> ? alternativeKeys, dynamic innerKey, int? innerListIndex, bool? defaultValue, ElementConverter<bool> ? converter}) → bool? -
Available on Map<
Tries to convert the value atK, V> ?, provided by the NullableMapConversionX extensionkey(oralternativeKeys) 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<
Tries to convert the value atK, V> ?, provided by the NullableMapConversionX extensionkey(oralternativeKeys) 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<
Tries to convert the value atK, V> ?, provided by the NullableMapConversionX extensionkey(oralternativeKeys) 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<
Tries to convert the value atK, V> ?, provided by the NullableMapConversionX extensionkey(oralternativeKeys) to an enum usingparser. -
tryGetInt(
K key, {List< K> ? alternativeKeys, dynamic innerKey, int? innerListIndex, int? defaultValue, String? format, String? locale, ElementConverter<int> ? converter}) → int? -
Available on Map<
Tries to convert the value atK, V> ?, provided by the NullableMapConversionX extensionkey(oralternativeKeys) to int. -
tryGetList<
T> (K key, {List< K> ? alternativeKeys, dynamic innerKey, int? innerListIndex, List<T> ? defaultValue, ElementConverter<T> ? elementConverter}) → List<T> ? -
Available on Map<
Tries to convert the value atK, V> ?, provided by the NullableMapConversionX extensionkey(oralternativeKeys) to a List ofT. -
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<
Tries to convert the value atK, V> ?, provided by the NullableMapConversionX extensionkey(oralternativeKeys) to a Map ofK2toV2. -
tryGetNum(
K key, {List< K> ? alternativeKeys, dynamic innerKey, int? innerListIndex, num? defaultValue, String? format, String? locale, ElementConverter<num> ? converter}) → num? -
Available on Map<
Tries to convert the value atK, V> ?, provided by the NullableMapConversionX extensionkey(oralternativeKeys) to num. -
tryGetSet<
T> (K key, {List< K> ? alternativeKeys, dynamic innerKey, int? innerListIndex, Set<T> ? defaultValue, ElementConverter<T> ? elementConverter}) → Set<T> ? -
Available on Map<
Tries to convert the value atK, V> ?, provided by the NullableMapConversionX extensionkey(oralternativeKeys) to a Set ofT. -
tryGetString(
K key, {List< K> ? alternativeKeys, dynamic innerKey, int? innerListIndex, String? defaultValue, ElementConverter<String> ? converter}) → String? -
Available on Map<
Tries to convert the value atK, V> ?, provided by the NullableMapConversionX extensionkey(oralternativeKeys) to String. -
tryGetUri(
K key, {List< K> ? alternativeKeys, dynamic innerKey, int? innerListIndex, Uri? defaultValue, ElementConverter<Uri> ? converter}) → Uri? -
Available on Map<
Tries to convert the value atK, V> ?, provided by the NullableMapConversionX extensionkey(oralternativeKeys) to Uri. -
tryParse<
T, K2, V2> (K key, T converter(Map< K2, V2> json)) → T? -
Available on Map<
Tries to parse the nested map atK, V> , provided by the MapConversionX extensionkeyusing the providedconverter. -
unflatten(
{String delimiter = '.', bool parseIndices = true}) → Map< String, Object?> - 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, ornullifkeyis not in the map.override -
operator []=(
K key, V value) → void -
Associates the
keywith the givenvalue.override