useIsolate static method
Implementation
static Future<dynamic> useIsolate(
args, functionThatIsToBeRunOnIsolates) async {
final ReceivePort receivePort = ReceivePort();
try {
await Isolate.spawn(
functionThatIsToBeRunOnIsolates, [receivePort.sendPort, args]);
} on Object {
debugPrint('Isolate Failed');
receivePort.close();
}
final response = await receivePort.first;
debugPrint('Result: $response');
return response;
}