jsonDecodeMapAs<K, V> function
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>();