MapGetOrDefault<K, V> extension

Typed getters for Map values — simple defaults and API/JSON parsing.

on

Methods

addKeyValue(K key, V value) Map<K, V>

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

Returns a new map with key added or replaced.
addKeyWithExcludeKeys(Map<K, V> additionalKeys, {List<K> excludeKeys = const []}) Map<K, V>

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

Merges additionalKeys and optionally removes excludeKeys.
excludeKeys(List<K> keysToExclude) Map<K, V>

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

Returns a copy of this map without keysToExclude.
getApiBoolOrDefault(K key, {bool defaultValue = false, List<K> alternativeKeys = const []}) bool

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

getApiColorOrDefault(K key, {Color? defaultValue, List<K> alternativeKeys = const []}) Color?

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

getApiDateTimeOrDefault(K key, {DateTime? defaultValue, List<K> alternativeKeys = const [], bool isUtc = true, bool trySecondsEpoch = true}) DateTime?

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

getApiDoubleOrDefault(K key, {double? defaultValue, List<K> alternativeKeys = const [], bool smartRound = false, int maxPrecision = 2}) double?

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

getApiIntOrDefault(K key, [int? defaultValue, List<K> alternativeKeys = const []]) int?

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

getApiListOrDefault<T>(K key, {List<T> defaultValue = const [], List<K> alternativeKeys = const []}) List<T>

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

getApiMapObject(K key, {List<K> alternativeKeys = const []}) Map<String, dynamic>?

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

getApiNumOrDefault(K key, {num? defaultValue, List<K> alternativeKeys = const [], bool smartRound = true, int maxPrecision = 2}) num?

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

getApiObjectOrDefault<T>(K key, {T? defaultValue, List<K> alternativeKeys = const []}) → T?

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

getApiStringOrDefault(K key, {String? defaultValue, List<K> alternativeKeys = const []}) String?

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

Returns a trimmed string for key or the first matching alternativeKeys.
getApiTimeOfDayOrDefault(K key, {TimeOfDay? defaultValue, List<K> alternativeKeys = const []}) TimeOfDay?

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

getApiUrlStringOrDefault(K key, {String? defaultValue, List<K> alternativeKeys = const []}) String?

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

Returns a validated URL string or defaultValue when invalid.
getDoubleOrDefault(K key, double? defaultValue) double?

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

Returns the double value for key, or defaultValue when missing/invalid.
getIntOrDefault(K key, int? defaultValue) int?

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

Returns the integer value for key, or defaultValue when missing/invalid.
getNumOrDefault(K key, num? defaultValue) num?

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

Returns the numeric value for key, or defaultValue when missing/invalid.
getOrDefault(K key, V? defaultValue) → V?

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

Returns the value associated with the given key, or defaultValue if the key does not exist.
getStringOrDefault(K key, String? defaultValue) String?

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

Returns the string value for key, or defaultValue when missing.