decodeObjectMap<T extends Coding> method
Returns a map of T
s associated with key
.
inflate
must create an empty instance of T
. The value associated with key
must be a KeyedArchive (a Map), where each value is a T
.
For each key-value pair of the archived map, inflate
is invoked and
each value is decoded into the instance of T
.
Implementation
Map<String, T?>? decodeObjectMap<T extends Coding>(String key, T Function() inflate) {
final v = _getValue(key);
if (v == null) {
return null;
}
if (v is! Map<String, dynamic>) {
throw ArgumentError(
"Cannot decode key '$key' as 'Map<String, $T>', because value is not a Map. Actual value: '$v'.",
);
}
return {for (var k in v.keys) k: _decodedObject(v[k] as KeyedArchive?, inflate)};
}