toJS property

JSExportedDartFunction<T> get toJS

A JavaScript function that forwards to the T-typed Function.

If the type argument to a use of this extension could not be determined at compile-time or if that type contains types that are disallowed, the call will fail to compile. See https://dart.cn/interop/js-interop/js-types#requirements-on-external-declarations-and-function-tojs for more details on what types are allowed.

The max number of arguments that are passed to this Dart function from the wrapper JavaScript function is determined by this Dart function's static type. Any extra arguments passed to the JavaScript function after the max number of arguments are discarded like they are with regular JavaScript functions.

Calling this on the same Function again will always result in a new JavaScript function.

Implementation

external JSExportedDartFunction<T> get toJS;