fix: Cast instead of shallow copy
This commit is contained in:
parent
5ea63b1f1f
commit
0ccf300777
|
|
@ -29,7 +29,7 @@ extension TryGetMapExtension on Map<String, dynamic> {
|
||||||
return fallbackValue;
|
return fallbackValue;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return List<T>.from(value);
|
return (value as List).cast<T>();
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
Logs().w(
|
Logs().w(
|
||||||
'Unable to create "List<${T.runtimeType}>" in event content for the key "$key"');
|
'Unable to create "List<${T.runtimeType}>" in event content for the key "$key"');
|
||||||
|
|
@ -50,7 +50,7 @@ extension TryGetMapExtension on Map<String, dynamic> {
|
||||||
return fallbackValue;
|
return fallbackValue;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return Map<A, B>.from(value);
|
return (value as Map).cast<A, B>();
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
Logs().w(
|
Logs().w(
|
||||||
'Unable to create "Map<${A.runtimeType},${B.runtimeType}>" in event content for the key "$key"');
|
'Unable to create "Map<${A.runtimeType},${B.runtimeType}>" in event content for the key "$key"');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue