Closed Shiberal closed 3 years ago
You cannot pass a function expression value, only a top-level or static function tear-off. Putting the closure into another object doesn't help.
What you can do is to create a class.
Instead of using (double x, bool y) { some code }
as a function expression, perhaps closing over local variables v
and w
, you can make a helper class:
class _LocalHelper {
final int v;
final String w;
_LocalHelper(this.v, this.w);
int call(double x, bool y) { some code }
}
and then send _LocalHelper(v, w)
as an object instead of the function.
dart throws an exception that doesn't allow me to pass a function type through isolate.spawn. ArgumentError (Invalid argument(s): Illegal argument in isolate message : (object is a FunctionType))
client is Socket type from socket.io dart library isolate = await Isolate.spawn(isolateClient, client);
https://pub.dev/packages/socket_io <-- this library.
so.. i need to listen for a connection and create a thread using isolate to 'isolate the client operations' but it seems like isolate was made just for math stuff in mind.
i also tried passing a List