allowInterop<F extends Function> function Null safety

F allowInterop<F extends Function>(
  1. F f
)

Returns a wrapper around function f that can be called from JavaScript using package:js JavaScript interop.

The calling conventions in Dart2Js differ from JavaScript and so, by default, it is not possible to call a Dart function directly. Wrapping with allowInterop creates a function that can be called from JavaScript or Dart. The semantics of the wrapped function are still more strict than JavaScript, and the function will throw if called with too many or too few arguments.

Calling this method repeatedly on a function will return the same result.

Implementation

external F allowInterop<F extends Function>(F f);