-
Notifications
You must be signed in to change notification settings - Fork 578
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
The error for using dart:io is unhelpful #3
Comments
It now reads:
Which is an intermediate step towards the above solution. |
We should prevent the Run button from being clickable, if the code somehow imports dart:io. |
add mode change events to the playground context
The error has been cleaned up quite a bit. We can get some more info from the backend when analyzing, to be able to recognize a sample that directly or transitively imports dart:io. |
I am confused. I am able to read a file in the darrrrt codelab, which depends on dart:html. So I expected that creating a simple example that relies on dart:io would also be able to read a file. I tried it and got a confusing error: CONSOLE If dart:io is not supported, I would expect a clearer message saying that dart:io is not supported. And why can I read a file in the Pirate codelab (dart:html) but not dart:io? You can see my example here: Here is the Pirate codelab, which reads a JSON file: |
Yeah, the net-net is that dart:io is not supported, and there's no real path to supporting it in dartpad. We can do something like scrape the error message that comes back from dart2js in order to display a better error message. You can use the dart:html apis to read a file because we compile your app to javascript and execute it in the browser (in an embedded iframe). We can't run a dart:io app in the browser, and we don't have a sandboxed environment to be able to execute it on a server :( |
The action item here is to improve the error message in order to make it clear that the reason the app failed to run is because the dart:io library is not supported in dartpad. |
Yes, thanks. |
Still an issue. You can even import 'dart:io' and get reasonable looking docs, which makes you think it'll be OK to use... |
Another user ran into this. |
Just opened a related but broader issue: #1000. I'm going to close this one as a duplicate of the new one. |
From @lukechurch on January 5, 2015 12:30
"Error compiling:
[500 Internal Server Error] [error, line 1] Library not found 'dart:io'."
Should be something along the lines of
"The dart:io library cannot be used in a browser context. Please see support page for common work arounds."
Lets chat about where we put in the fix.
Copied from original issue: devoncarew/dartpad_ui#14
The text was updated successfully, but these errors were encountered: