tryGetMap<A, B> method
Implementation
Map<A, B>? tryGetMap<A, B>(String key, [TryGet log = TryGet.optional]) {
final Object? value = this[key];
if (value is! Map) {
log(key, <A, B>{}.runtimeType, value.runtimeType);
return null;
}
try {
// copy map to ensure type check failures here and not an access
return Map.from(value.cast<A, B>());
} catch (_) {
Logs().v(
'Unable to create "Map<$A,$B>" in event content for the key "$key" at ${StackTrace.current.firstLine}',
);
return null;
}
}