Dart_IsolateGroupCreateCallback typedef
An isolate creation and initialization callback function.
This callback, provided by the embedder, is called when the VM needs to create an isolate. The callback should create an isolate by calling Dart_CreateIsolateGroup and load any scripts required for execution.
This callback may be called on a different thread than the one running the parent isolate.
When the function returns NULL, it is the responsibility of this function to ensure that Dart_ShutdownIsolate has been called if required (for example, if the isolate was created successfully by Dart_CreateIsolateGroup() but the root library fails to load successfully, then the function should call Dart_ShutdownIsolate before returning).
When the function returns NULL, the function should set *error to a malloc-allocated buffer containing a useful error message. The caller of this function (the VM) will make sure that the buffer is freed.
\param script_uri The uri of the main source file or snapshot to load. Either the URI of the parent isolate set in Dart_CreateIsolateGroup for Isolate.spawn, or the argument to Isolate.spawnUri canonicalized by the library tag handler of the parent isolate. The callback is responsible for loading the program by a call to Dart_LoadScriptFromKernel. \param main The name of the main entry point this isolate will eventually run. This is provided for advisory purposes only to improve debugging messages. The main function is not invoked by this function. \param package_root Ignored. \param package_config Uri of the package configuration file (either in format of .packages or .dart_tool/package_config.json) for this isolate to resolve package imports against. If this parameter is not passed the package resolution of the parent isolate should be used. \param flags Default flags for this isolate being spawned. Either inherited from the spawning isolate or passed as parameters when spawning the isolate from Dart code. \param isolate_data The isolate data which was passed to the parent isolate when it was created by calling Dart_CreateIsolateGroup(). \param error A structure into which the embedder can place a C string containing an error message in the case of failures.
\return The embedder returns NULL if the creation and initialization was not successful and the isolate if successful.
Implementation
typedef Dart_IsolateGroupCreateCallback
= ffi.Pointer<ffi.NativeFunction<Dart_IsolateGroupCreateCallbackFunction>>;