dart:isolate library
Properties
final ReceivePort port #
The initial ReceivePort available by default for this isolate. This ReceivePort is created automatically and it is commonly used to establish the first communication between isolates (see spawnFunction and spawnUri).
ReceivePort get port => _Isolate.port;
final IsolateStream stream #
The initial IsolateStream available by default for this isolate. This
IsolateStream is created automatically and it is commonly used to establish
the first communication between isolates (see streamSpawnFunction and
streamSpawnUri).
final IsolateStream stream = new IsolateStream._fromOriginalReceivePort(port)
Functions
IsolateSink streamSpawnFunction(void topLevelFunction(), [bool unhandledExceptionCallback(IsolateUnhandledException e)]) #
Creates and spawns an isolate that shares the same code as the current isolate, but that starts from topLevelFunction. The topLevelFunction argument must be a static top-level function or a static method that takes no arguments.
When any isolate starts (even the main script of the application), a default IsolateStream is created for it. This sink is available from the top-level getter stream defined in this library.
spawnFunction returns an IsolateSink feeding into the child isolate's default stream.
The optional
unhandledExceptionCallback argument is invoked whenever an
exception inside the isolate is unhandled. It can be seen as a big
try/catch around everything that is executed inside the isolate. The
callback should return true when it was able to handled the exception.
external IsolateSink streamSpawnFunction( void topLevelFunction(), [bool unhandledExceptionCallback(IsolateUnhandledException e)]);
SendPort spawnUri(String uri) #
Creates and spawns an isolate whose code is available at uri. Like with spawnFunction, the child isolate will have a default ReceivePort, and a this function returns a SendPort derived from it.
SendPort spawnUri(String uri) => _Isolate.spawnUri(uri);
SendPort spawnFunction(void topLevelFunction(), [bool unhandledExceptionCallback(IsolateUnhandledException e)]) #
Creates and spawns an isolate that shares the same code as the current isolate, but that starts from topLevelFunction. The topLevelFunction argument must be a static top-level function or a static method that takes no arguments. It is illegal to pass a function closure.
When any isolate starts (even the main script of the application), a default ReceivePort is created for it. This port is available from the top-level getter port defined in this library.
spawnFunction returns a SendPort derived from the child isolate's default port.
The optional
unhandledExceptionCallback argument is invoked whenever an
exception inside the isolate is unhandled. It can be seen as a big
try/catch around everything that is executed inside the isolate. The
callback should return true when it was able to handled the exception.
SendPort spawnFunction(void topLevelFunction(), [bool unhandledExceptionCallback(IsolateUnhandledException e)]) => _Isolate.spawnFunction(topLevelFunction, unhandledExceptionCallback);