W3cubDocs

/Dart 2

JsObject.fromBrowserObject constructor

JsObject.fromBrowserObject(dynamic object)

Constructs a JsObject that proxies a native Dart object; for expert use only.

Use this constructor only if you wish to get access to JavaScript properties attached to a browser host object, such as a Node or Blob, that is normally automatically converted into a native Dart object.

An exception will be thrown if object either is null or has the type bool, num, or String.

Implementation

factory JsObject.fromBrowserObject(object) {
  if (object is num || object is String || object is bool || object == null) {
    throw new ArgumentError("object cannot be a num, string, bool, or null");
  }
  return _wrapToDart(_convertToJS(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.fromBrowserObject.html