JsObject.jsify constructor

JsObject.jsify(
  1. dynamic object
)

Recursively converts a JSON-like collection of Dart objects to a collection of JavaScript objects and returns a JsObject proxy to it.

object must be a Map or Iterable, the contents of which are also converted. Maps and Iterables are copied to a new JavaScript object. Primitives and other transferrable values are directly converted to their JavaScript type, and all other objects are proxied.

Implementation

factory JsObject.jsify(dynamic object) {
  if ((object is! Map) && (object is! Iterable)) {
    throw ArgumentError('object must be a Map or Iterable');
  }
  throw UnsupportedError(
      'JavaScript interop is not supported in this runtime.');
}