-
Notifications
You must be signed in to change notification settings - Fork 383
(Web) StreamedRequest is a lie #1030
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
You could consider using We are currently working on better documentation that recommends appropriate |
@brianquinlan that is a terrible answer. the standard http package should use fetch for the streaming request and response when it is available. I shouldn't have to write platform specific code to do streaming because the built in http package is based on tech from IE 5.5. That defeats the whole point of having the cross platform http package in the first place. |
@brianquinlan StreamedRequest and StreamedResponse exist to stream. They work on every platform except web. They should work on web. There is no good reason they can't. It doesn't even need to be a breaking change and it has been a supported and standard part of the web platform for a while. |
Continued discussion about moving to |
Steps to reproduce
Try to upload a large file using http.StreamedRequest with Flutter web (try 4GB). You'll always get an error:
The browser implementation of StreamedRequest always reads the entire request and response into memory. This doesn't have to happen as browsers have supported streaming via fetch for a very long time and makes flutter web totally broken if you need to deal with large files such as video, as this will cause the browser to complain that it can't allocate buffers that large: "RangeError: Array buffer allocation failed"
https://github.com/dart-lang/http/blob/master/pkgs/http/lib/src/browser_client.dart
StreamedRequest/StreamedResponse should be updated to use streaming fetch requests, as the current implementation defeats the point of why you would be using the streamed APIs in the first place. As of the moment, there's no way to upload large files to an S3 / Google cloud storage presigned url without throwing away the http package entirely on web. The whole point of this class is to stream, and it doesn't stream at all.
The text was updated successfully, but these errors were encountered: