@@ -396,6 +396,30 @@ abstract final class NativeCallable<T extends Function> {
396396    throw  UnsupportedError ("NativeCallable cannot be constructed dynamically." );
397397  }
398398
399+   /// Constructs a [NativeCallable]  that can be invoked from any thread. 
400+   /// 
401+   /// When the native code invokes the function [nativeFunction] , 
402+   /// the [callback]  will be executed within the isolate group 
403+   /// of the [Isolate]  which originally constructed the callable. 
404+   /// Specifically, this means that an attempt to access any 
405+   /// static or global field which is not shared between 
406+   /// isolates in a group will result in a [Error] . 
407+   /// 
408+   /// If an exception is thrown by the [callback] , the 
409+   /// native function will return the `exceptionalReturn` , 
410+   /// which must be assignable to the return type of 
411+   /// the [callback] . 
412+   /// 
413+   /// [callback]  and [exceptionalReturn]  must be 
414+   /// _trivially shareable_. 
415+   /// 
416+   /// This callback must be [close] d when it is no longer 
417+   /// needed. An [Isolate]  that created the callback will 
418+   /// be kept alive until [close]  is called. 
419+   /// 
420+   /// After [NativeCallable.close]  is called, invoking 
421+   /// the [nativeFunction]  from native code will cause 
422+   /// undefined behavior. 
399423   factory  NativeCallable .isolateGroupBound (
400424    @DartRepresentationOf ("T" ) Function  callback, {
401425    Object ?  exceptionalReturn,
0 commit comments