jsonDecodeMapAs<K, V> function

Map<K, V> jsonDecodeMapAs<K, V>(
  1. dynamic json
)

Decodes a JSON string into a Map<K, V>, throwing errors for invalid types.

try {
  final result = jsonDecodeMapAs<String, int>('{"key": 1}');
  print(result); // {key: 1}
} catch (e) {
  print('Error: $e');
}

@ai Use when you need a map result regardless of input validity. Handle errors externally.

Implementation

Map<K, V> jsonDecodeMapAs<K, V>(final dynamic json) =>
    jsonDecodeMap(json).cast<K, V>();