objectDartify method

Object? objectDartify()

Converts an Object, which could be a JSAny, to a Dart type in a graceful manner. See isJSAny.

Implementation

Object? objectDartify() {
  final self = this;
  if (self == null) return null;

  var isJSAny = self.isJSAny;

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