transformToBrowserJSObject static method

dynamic transformToBrowserJSObject(
  1. dynamic obj
)

Implementation

static dynamic transformToBrowserJSObject(dynamic obj) {
  if (obj is Map) {
    return js.JsObject.jsify(obj.map(
        (key, value) => MapEntry(key, transformToBrowserJSObject(value))));
  } else if (obj is List) {
    return js.JsObject.jsify(
        obj.map((e) => transformToBrowserJSObject(e)).toList());
  } else if (obj is Function) {
    return Context.shared.createFunctionArgN(obj);
  } else if (obj is JSObject) {
    return obj.jsObject;
  } else {
    return obj;
  }
}