-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Illegal argument in isolate message that works or break without changing much of the code #59866
Comments
Summary: Using |
for clarification, this code is not in the main in my app but in a Riverpod provider. this is why you see it referenced |
making |
It's the Using an instance meeting will include the So this looks like it's working as intended. You have to be very careful about functions that are sent to other isolates. |
@lrhn I didn't expect that referencing a member function from another member function that uses I would have expected the error message to be "foo is not a top-level function" rather than this:
now I know it means "We bring the word attached to this function and the world is not serializable" but I find it really hard to understand without context |
Does it make sense to restrict them to static and top-level functions, at least at the "linter level"? |
That's where it started. The VM made an effort to allow passing closures too because it's useful. You can't generally tell where a closure (a function value) comes from, unless you can see the expression that creates it. Otherwise all you know is it's function type. Maybe it would be useful to warn if the closure passed to an isolate communicating function ( That could be an analyzer warning, or it could be something the VM does itself. It should probably be the analyzer, because it supports ignoring warnings. It would only trigger for arguments to a few recognized functions, which are only available to native code, so the cost of checking should be fairly limited. |
@lrhn analyzer warning/linter would be great when using |
this code works:
but moving the function executed by compute to it's own function result in the following error:
Here is the new code:
The text was updated successfully, but these errors were encountered: