isCastedMap method
Returns true
if o
is a Map<K,V>
where K
is arguments0 T
and V
is arguments1 T
.
K
orV
should be valid. See isValidGenericType.- This TypeInfo should be a Map. See isMap.
Implementation
bool isCastedMap(Object? o) {
if (!isMap || o is! Map) return false;
var arg0 = arguments0;
var arg1 = arguments1;
var arg0Ok = arg0 != null && arg0.isValidGenericType;
var arg1Ok = arg1 != null && arg1.isValidGenericType;
if (arg0Ok && arg1Ok) {
return arg0.callCasted(<K>() {
return arg1.callCasted(<V>() => o is Map<K, V>);
});
} else if (arg0Ok) {
return arg0.callCasted(<K>() => o is Map<K, dynamic>);
} else if (arg1Ok) {
return arg1.callCasted(<V>() => o is Map<dynamic, V>);
} else {
return false;
}
}