read<R extends V> method

R? read<R extends V>(
  1. K key, [
  2. R? defaultValue
])

Return the value of key in the map if the value type is R. Otherwise, return defaultValue.

Implementation

R? read<R extends V>(K key, [R? defaultValue]) {
  final value = this[key];
  return (value is R) ? value : defaultValue;
}