W3cubDocs

/Dart 2

JsObject.jsify constructor

JsObject.jsify(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(object) {
  if ((object is! Map) && (object is! Iterable)) {
    throw new ArgumentError("object must be a Map or Iterable");
  }
  return _wrapToDart(_convertDataTree(object));
}

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.5.0/dart-js/JsObject/JsObject.jsify.html