tryGet<T extends Object> method

T? tryGet<T extends Object>(
  1. String key, [
  2. TryGet log = TryGet.optional
])

Implementation

T? tryGet<T extends Object>(String key, [TryGet log = TryGet.optional]) {
  final Object? value = this[key];
  if (value is! T) {
    log(key, T, value.runtimeType);
    return null;
  }
  return value;
}