asJSAny property

JSAny? get asJSAny

Casts an Object to a JSAny, in a graceful manner. See isJSAny.

Implementation

JSAny? get asJSAny {
  final self = this;
  if (self == null) return null;

  var isJSAny = self.isJSAny;
  if (isJSAny != null) {
    if (isJSAny) {
      return self as JSAny;
    } else {
      return null;
    }
  } else {
    try {
      return self as JSAny;
    } catch (_) {
      return null;
    }
  }
}