MapExtensions<K, V> extension
Extension methods on Map for safe nested value access and deep merging.
final map = {'user': {'name': 'Alice', 'address': {'city': 'Paris'}}};
map.getPath<String>('user.address.city'); // 'Paris'
map.getPath('user.address.zip'); // null
- on
-
- Map<
K, V>
- Map<
Methods
-
deepMerge(
Map< K, dynamic> other) → Map<K, dynamic> -
Available on Map<
Recursively mergesK, V> , provided by the MapExtensions extensionotherinto this map, returning a new Map. -
getPath<
T> (String path) → T? -
Available on Map<
Navigates a dot-separatedK, V> , provided by the MapExtensions extensionpathinto nested Maps and returns the value at the leaf. -
tryBool(
K key) → bool? -
Available on Map<
Returns the bool value forK, V> , provided by the MapExtensions extensionkey, ornullif absent or not a bool. -
tryDouble(
K key) → double? -
Available on Map<
Returns the double value forK, V> , provided by the MapExtensions extensionkey, ornullif absent or not a double. -
tryGet<
T> (K key) → T? -
Available on Map<
Type-safe typed accessor that returns the value forK, V> , provided by the MapExtensions extensionkeyif it is of typeT, otherwisenull. -
tryInt(
K key) → int? -
Available on Map<
Returns the int value forK, V> , provided by the MapExtensions extensionkey, ornullif absent or not an int. -
tryList<
T> (K key) → List< T> ? -
Available on Map<
Returns the List<T> value forK, V> , provided by the MapExtensions extensionkey, ornullif absent or not a List<T>. -
tryMap<
K2, V2> (K key) → Map< K2, V2> ? -
Available on Map<
Returns the Map<K2, V2> value forK, V> , provided by the MapExtensions extensionkey, ornullif absent or not a Map<K2, V2>. -
tryString(
K key) → String? -
Available on Map<
Returns the String value forK, V> , provided by the MapExtensions extensionkey, ornullif absent or not a String.