description

# NativeCallable<T extends Function>.isolateGroupBound constructor

NativeCallable<T extends Function>.isolateGroupBound(

1. @DartRepresentationOf("T") Function callback, {
2. Object? exceptionalReturn,

})

Constructs a NativeCallable that can be invoked from any thread.

When the native code invokes the function nativeFunction, the `callback` will be executed within the isolate group of the Isolate which originally constructed the callable. Specifically, this means that an attempt to access any static or global field which is not shared between isolates in a group will result in a Error.

If an exception is thrown by the `callback`, the native function will return the `exceptionalReturn`, which must be assignable to the return type of the `callback`.

`callback` and `exceptionalReturn` must be trivially shareable.

This callback must be closed when it is no longer needed.

After NativeCallable.close is called, invoking the nativeFunction from native code will cause undefined behavior.

NOTE: This is an experimental feature and may change in the future.

## Implementation

    factory NativeCallable.isolateGroupBound(
      @DartRepresentationOf("T") Function callback, {
      Object? exceptionalReturn,
    }) {
      throw UnsupportedError("NativeCallable cannot be constructed dynamically.");
    }