-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Lose generic information across isolate #40919
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
There is currently no way to specify a non-constant function reference as the isolate entry point. That means that What you can do is to send the function as data instead of as entry point. class _Generic2<T, U, P> {
final P parameter;
final void Function<T, U>(P) function;
_Generic2(this.function, this.parameter);
void call() {
function<T, U>(parameter);
}
static void entry(_Generic2 parameters) {
parameters();
}
}
...
Isolate.spawn(_Generic2.entry,
_Generic2<T, U, SendPort>(_process, receivePort.sendPort)); |
Works great and solves all problems! Thank you very much! |
We'll solve this issue as part of #36097. |
We are waiting for the addition of this feature (Lightweight Isolates and Isolate group), it will make possible to use isolates more often! Maybe common interface with the web (web/service workers) and I am in paradise during my lifetime) |
Closing this issue, merge into the more general #46623. |
code:
Runtime exception:
type '(int) => int' is not a subtype of type '(dynamic) => dynamic'
is generated when we executemapper = input;
Expected:
Ideally I could say something like:
Isolate.spawn(_process<T, U>, receivePort.sendPort);
so I wouldn't lose that type information when the function is executed in the other isolate.The text was updated successfully, but these errors were encountered: