getAsMap<T> method
Retrieves the element of key
of type Map from Map.
If Map does not have an element of key
or the type does not match Map<String, T>, orElse
is returned.
Mapにkey
の要素がない場合やMap<String, T>と型が合わない場合、orElse
が返されます。
Implementation
Map<String, T> getAsMap<T>(K key, [Map<String, T>? orElse]) {
assert(key != null, "The key is empty.");
if (!containsKey(key) || this[key] is! Map?) {
return orElse ?? {};
}
return (this[key] as Map?)?.cast<String, T>() ?? orElse ?? {};
}