Skip to content

createJSInteropWrapper<T extends Object>

JSObject createJSInteropWrapper<T extends Object>(
  T dartObject, [
  JSObject? proto = null,
])

Given a instance of a Dart class that contains an <code>@JSExport</code> annotation, creates a JavaScript object that wraps the given Dart object.

The object literal will be a map of properties, which are either the written instance member names or their renames, to callbacks that call the corresponding Dart instance members.

If proto is provided, it will be used as the prototype for the created object.

See https://dart.dev/interop/js-interop/mock for more details on how to declare classes that can be used in this method.