Future<Uint8List> bake() async { final p = ReceivePort(); // spawn the isolate and wait for it to complete await Isolate.spawn(_compressImageIsolate, p.sendPort); return await p.first; }