-
Notifications
You must be signed in to change notification settings - Fork 26.7k
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
[cross_file] [web] Implement openRead
correctly.
#91867
Comments
I am trying to upload image to google drive on web
I received the xfile using image_picker
Please let me know if I am doing anything wrong or what's the issue here |
Okay, so I actually needed a Stream<List < int > > instead of Stream
|
I have a very promising demo here: The app allows selecting files of any size and stream their contents without impacting the memory usage of the browser greatly. (It's based off of the PR linked above, and a small tweak to package file_selector.) |
Do we have an ETA for when we think this PR may be merged? |
Please see here for a partial workaround using the File System API: flutter/packages#5158 (comment) |
Not one to harass on a package but also curious; I feel like I've patiently watched paint dry on this issue for years. I know Stuart is super busy with platform issues - maybe it makes sense to reassign the factories? |
The current implementation of
XFile.openRead
is not really streaming the contents of the enclosed Blob as a Stream. It just slices a cached blob and returning that slice, in one go.People are chunking files by computing the chunks from the outside using the start/end variables, and then listening for the (only) event on the Stream. This is very inefficient, and even though it works, it is not what the Stream is supposed to do!
Users need to get a Stream from the slice they care about in the blob, and then read it until its completion. See an example of the dart:io implementation:
_FileStream
cross_file
needs a_BlobStream
class for its web implementation.The text was updated successfully, but these errors were encountered: