isJSAny property
bool?
get
isJSAny
Returns true if this instance is a JSAny.
Returns null if it's an ambiguous Dart/JS type.
Implementation
bool? get isJSAny {
final self = this;
if (self == null) return false;
// TODO: check a better way to identify a `JSAny` instance:
// Ambiguous types:
if (self is String) {
// ignore: invalid_runtime_check_with_js_interop_types
if (self is JSString) {
return true;
} else {
return false;
}
}
if (self is num) {
// ignore: invalid_runtime_check_with_js_interop_types
if (self is JSNumber) {
return true;
} else {
return false;
}
}
if (self is bool) {
// ignore: invalid_runtime_check_with_js_interop_types
if (self is JSBoolean) {
return true;
} else {
return false;
}
}
if (self is Function) {
// ignore: invalid_runtime_check_with_js_interop_types
if (self is JSFunction) {
return null;
} else {
return false;
}
}
if (self is List) {
// ignore: invalid_runtime_check_with_js_interop_types
if (self is JSArray || self is JSTypedArray) {
return null;
} else {
return false;
}
}
if (self is Map) {
// ignore: invalid_runtime_check_with_js_interop_types
if (self is JSArray || self is JSObject) {
return null;
} else {
return false;
}
}
// ignore: invalid_runtime_check_with_js_interop_types
return self is JSAny;
}