getAsInt method
Retrieves the element of key
of type int from Map.
If Map has no element of key
, or if the type does not match int, or if Map is itself Null, orElse
is returned.
Implementation
int getAsInt(K key, [int orElse = 0]) {
assert(key != null, "The key is empty.");
if (this == null || !containsKey(key) || this![key] is! num?) {
return orElse;
}
return (this![key] as num?)?.toInt() ?? orElse;
}