jsify function Null safety

dynamic jsify(
  1. Object object
)

Recursively converts a JSON-like collection to JavaScript compatible representation.

WARNING: performance of this method is much worse than other util methods in this library. Only use this method as a last resort. Prefer instead to use @anonymous @JS() annotated classes to create map-like objects for JS interop.

The argument must be a Map or Iterable, the contents of which are also deeply converted. Maps are converted into JavaScript objects. Iterables are converted into arrays. Strings, numbers, bools, and @JS() annotated objects are passed through unmodified. Dart objects are also passed through unmodified, but their members aren't usable from JavaScript.

Implementation

dynamic jsify(Object object) {
  if ((object is! Map) && (object is! Iterable)) {
    throw ArgumentError("object must be a Map or Iterable");
  }
  return _convertDataTree(object);
}