MapExtension<T> extension
Extension on Map to provide additional functionality and utility methods.
This extension enhances the capabilities of Map<T, T> by adding methods for:
- Checking key-value pair existence
- Retrieving and casting values to specific types
- Manipulating the map based on keys or values
- Comparing maps
- Safely accessing values with type-specific getters
These methods aim to simplify common map operations and provide more robust ways of working with map data in Dart.
- on
-
- Map<
T, T>
- Map<
Methods
-
diffKeys<
K, V> (Map< K, V> map) → Map<T, T> -
Available on Map<
Returns a new map containing entries from this map that are not inT, T> , provided by the MapExtension extensionmap
. -
diffValues(
Map< T, T> map) → Map<T, T> -
Available on Map<
Returns a new map containing entries from this map that are not inT, T> , provided by the MapExtension extensionmap
. -
doesntHave(
String key, T value) → bool -
Available on Map<
Checks if the map does not contain the givenT, T> , provided by the MapExtension extensionkey
/value
pair. -
getBool(
String key) → bool -
Available on Map<
Retrieves a boolean value for the givenT, T> , provided by the MapExtension extensionkey
. -
getDouble(
String key, {double? defaultValue}) → double? -
Available on Map<
Retrieves a double value for the givenT, T> , provided by the MapExtension extensionkey
. -
getId(
{T? defaultValue}) → T? -
Available on Map<
Retrieves the value associated with the 'id' key, if it exists.T, T> , provided by the MapExtension extension -
getInt(
String key, {int? defaultValue}) → int? -
Available on Map<
Retrieves an integer value for the givenT, T> , provided by the MapExtension extensionkey
. -
getList<
K> (String key) → List< T> -
Available on Map<
Retrieves a list of typeT, T> , provided by the MapExtension extensionT
for the givenkey
. -
getString(
String key, {String? defaultValue}) → String? -
Available on Map<
Retrieves a string value for the givenT, T> , provided by the MapExtension extensionkey
. -
has(
String key, dynamic value) → bool -
Available on Map<
Checks if the map contains the givenT, T> , provided by the MapExtension extensionkey
/value
pair. -
match(
T condition, [String? byDefault = 'Invalid input']) → Object? -
Available on Map<
Retrieves the value associated withT, T> , provided by the MapExtension extensioncondition
key. -
pick(
List< T> keys) → Map<T, T> -
Available on Map<
Creates a new map containing only the specifiedT, T> , provided by the MapExtension extensionkeys
from this map. -
removeNullValues(
) → Map< T, T> -
Available on Map<
Creates a new map excluding entries with null values from this map.T, T> , provided by the MapExtension extension -
retainKeys(
List< T> keys) → Map<T, T> -
Available on Map<
Removes key/value pairs from the map whose keys are not in the givenT, T> , provided by the MapExtension extensionkeys
list.