toJS property

JSExportedDartFunction get toJS

A callable JavaScript function that wraps this Function.

If the static type of the Function could not be determined or if the static type uses 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 Function from the wrapper JavaScript function is determined by this 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 get toJS;