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 inflate()) {
var v = _getValue(key);
if (v == null) {
return null;
}
if (v is! Map<String, dynamic>) {
throw new ArgumentError(
"Cannot decode key '$key' as 'Map<String, $T>', because value is not a Map. Actual value: '$v'.");
}
return Map<String, T?>.fromIterable(v.keys,
key: (k) => k, value: (k) => _decodedObject(v[k], inflate));
}