getAsSet<T> method
Retrieves the element of key
of type Set from Map.
If Map does not have an element of key
or the type does not match Set<T>, orElse
is returned.
Implementation
Set<T> getAsSet<T>(K key, [Set<T>? orElse]) {
assert(key != null, "The key is empty.");
if (!containsKey(key) || this[key] is! Set?) {
return orElse ?? {};
}
return (this[key] as Set?)?.cast<T>() ?? orElse ?? {};
}