-
Notifications
You must be signed in to change notification settings - Fork 1.7k
http requests throw when called from Isolate.run() but work when called from compute() #52336
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
Are you running your code in a browser? |
@julemand101 |
Definitely not running in a browser, since My best guess is that the closure Try adding a top-level helper like: R Function() curryFunction<R, T>(R Function(T) function, T argument) => () => function(argument); and do: final test = await Isolate.run(curryFunction(myRequest, argument));` That should ensure that the Q.v. #36983 |
Yes, now it works. However, I don't quite understand the problem. Is this a mistake I made or a bug in dart? |
I think it's a bug, which is why #36983 (and the duplicate #50462 that I filed) exist. It's a gnarly problem for the VM implementation, because it goes to the heart of their closure implementation, but I hope it will be fixed eventually. (Preferably soon, because this is just the most visible way to see the problem, but overcapturing can also have a memory cost if large values are kept alive, even if nobody needs them.) |
I see. Thanks for your quick help! |
Uh oh!
There was an error while loading. Please reload this page.
I am trying to execute a http request from an Isolate.
when I try to run it with Isolate.run() like this
I am getting an error :
ArgumentError (Invalid argument(s): Illegal argument in isolate message: (object extends NativeWrapper - Library:'dart:ui' Class: Paragraph))
but when I run it with compute
it works. Is this intended?
The text was updated successfully, but these errors were encountered: