get method
- Option key,
- {required Value fallback}
Gets the value from the map for the provided key. If the key does not
exist in the map, it returns the value of the fallback
parameter.
-
Parameters:
- key: The key for which to fetch the value from the map.
- fallback: The value to be returned if the key does not exist in the map.
-
Returns: The value for the given key if it exists, otherwise the
fallback
value.
Implementation
Value get(Option key, {required Value fallback}) {
return this[key] ?? fallback;
}