getOrDefault<T> method

T? getOrDefault<T>(
  1. K key,
  2. T defaultValue
)

Implementation

T? getOrDefault<T>(K key, T defaultValue) {
  final thiz = this;
  if (thiz == null) return defaultValue;
  final value = thiz[key];
  if (value is T) {
    return value;
  }
  return defaultValue;
}