I have application written on Flutter (Dart)
and I have integrated FFI
library. I need to call a method from that library on a separate Isolate
but it gives me a following error:
Unhandled Exception: Invalid argument(s): Illegal argument in isolate message: (object is a DynamicLibrary)
Here is my code:
class Hub {
static final Hub _singleton = Hub._internal();
late hub lib;
late Pointer<hub_state_s> state;
factory Hub() {
return _singleton;
}
Hub._internal();
}
start() async {
Hub hub = Hub();
var initResult = await hub.init();
if (initResult == 0) {
await Isolate.run(() {
print("running isolate");
hub.lib.hub_start(hub.state);
});
}
}