fix: Make tryget type optional by default
I see soo much annoying warnings in the logs since matrix 0.2.0 and to be honest it was never helpful to have this logs. Therefore it seems to make more sense to make those warnings optional.
This commit is contained in:
parent
3dd1230ffb
commit
916711cf57
|
|
@ -60,7 +60,7 @@ class _SilentLog implements TryGet {
|
|||
}
|
||||
|
||||
extension TryGetMapExtension on Map<String, dynamic> {
|
||||
T? tryGet<T extends Object>(String key, [TryGet log = TryGet.required]) {
|
||||
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);
|
||||
|
|
@ -69,7 +69,7 @@ extension TryGetMapExtension on Map<String, dynamic> {
|
|||
return value;
|
||||
}
|
||||
|
||||
List<T>? tryGetList<T>(String key, [TryGet log = TryGet.required]) {
|
||||
List<T>? tryGetList<T>(String key, [TryGet log = TryGet.optional]) {
|
||||
final Object? value = this[key];
|
||||
if (value is! List) {
|
||||
log(key, T, value.runtimeType);
|
||||
|
|
@ -85,7 +85,7 @@ extension TryGetMapExtension on Map<String, dynamic> {
|
|||
}
|
||||
}
|
||||
|
||||
Map<A, B>? tryGetMap<A, B>(String key, [TryGet log = TryGet.required]) {
|
||||
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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue