isJSObject property

bool? get isJSObject

Returns true if this instance is a JSObject. Returns null if it's an ambiguous Dart/JS type.

Implementation

bool? get isJSObject {
  final self = this;
  if (self == null) return false;

  if (self is String) {
    return false;
  }
  // ignore: invalid_runtime_check_with_js_interop_types
  else if (self is JSString) {
    if (self.isA<JSString>()) return false;
  }

  if (self is num) {
    return false;
  }
  // ignore: invalid_runtime_check_with_js_interop_types
  else if (self is JSNumber) {
    if (self.isA<JSNumber>()) return false;
  }

  if (self is bool) {
    return false;
  }
  // ignore: invalid_runtime_check_with_js_interop_types
  else if (self is JSBoolean) {
    if (self.isA<JSBoolean>()) return false;
  }

  if (self is List) {
    // ignore: invalid_runtime_check_with_js_interop_types
    if (self is JSArray) {
      // ignore: invalid_runtime_check_with_js_interop_types
      if ((self as JSAny).isA<JSArray>()) {
        return null;
      }
    }
    // ignore: invalid_runtime_check_with_js_interop_types
    else if (self is JSObject) {
      // ignore: invalid_runtime_check_with_js_interop_types
      if ((self as JSAny).isA<JSObject>()) {
        return true;
      }
    } else {
      return false;
    }
  }

  if (self is Map) {
    // ignore: invalid_runtime_check_with_js_interop_types
    if (self is JSArray) {
      // ignore: invalid_runtime_check_with_js_interop_types
      if ((self as JSAny).isA<JSArray>()) {
        return true;
      }
    }
    // ignore: invalid_runtime_check_with_js_interop_types
    else if (self is JSObject) {
      // ignore: invalid_runtime_check_with_js_interop_types
      if ((self as JSAny).isA<JSObject>()) {
        return true;
      }
    } else {
      return false;
    }
  }

  if (self is Function) {
    // ignore: invalid_runtime_check_with_js_interop_types
    if (self is JSFunction) {
      return true;
    } else {
      return false;
    }
  }
  // ignore: invalid_runtime_check_with_js_interop_types
  else if (self is JSFunction) {
    return true;
  }

  // ignore: invalid_runtime_check_with_js_interop_types
  if (self is JSArray) {
    return true;
  }

  // ignore: invalid_runtime_check_with_js_interop_types
  return self is JSObject;
}