Isolates won't work on dart pad , you should use a local environment.
Spawning isolates
A single isolate running it's own event loop
Each isolate has their own segment of memory
The "entryFunction" has to be a top level function(i.e. not any function inside class or interface or something like that) or a static function
Working with ports
Passing objects into isolates
Creating a Two way connection between isolates
In Flutter you can use "compute" method which handles a lot the things for you and it's much easier to implement
This section gives you a basic idea about how to work with isolates . But you can imagine how complicated it will get if you need to manage multiple isolates . You should write a separate class that will help deal with this efficiently . Or use some high level package from pub.dev
import 'dart:isolate';
void main() {
// isolates
Isolate.spawn(entryFunction, "This is a message from the main isolate");
print("Inside Main Isolate");
}
void entryFunction(message) {
print(message);
}
import 'dart:isolate';
void main() async {
// isolates
Isolate i1 = await Isolate.spawn(
entryFunction, "This is a message from the main isolate");
print("Inside Main Isolate");
}
void entryFunction(message) {
print(message);
}