-
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] Platform-aware factories. #91869
Comments
|
I ran into a pretty serious limitation caused by this issue. Because |
@Jjagg yes, having a |
I've seen a huge improvement of the performance of Here's a demo app: https://dit-tests.web.app; when selecting a large file you'll see that it'll get processed immediately, instead of being copied over as a network "resource". The prototype also includes a fix for this issue: |
I think this can be extended to every platform and that we should federate the plugin. Android and iOS have there own systems for reading and writing to files that are external to the application: Android: https://developer.android.com/training/data-storage/shared/documents-files#java For Android, I wasn't able to use |
Indeed! @stuartmorgan and I discussed this briefly a couple of weeks ago and decided to push it to after new year, but it's on the radar! |
This issue is assigned to @stuartmorgan but has had no recent status updates. Please consider unassigning this issue if it is not going to be addressed in the near future. This allows people to have a clearer picture of what work is actually planned. Thanks! |
The current implementation of
cross_file
relies on cross-platform constructors that "need to work" across all platforms. With time, and as features are added, these constructors end up growing, and now some parameters are being ignored by some platforms and used by others. This causes confusion/problems.It seems that cross-platform constructors are not the way to go for this particular package; instead XFile users should be able to choose what factory they need for the platform that they're implementing. So, in places where
dart:io
is available, they could do:XFileIO.fromFile(io.File file)
orXFileIO.fromPath(String path)
But if
dart:html
is availableXFileWeb.fromHtmlFile(html.File file)
orXFileWeb.fromBlob(html.Blob blob, String name)
orXFileWeb.fromBlobUrl(String blobUrl, String name, int length...)
...or any other "specialty" constructors that would make sense per platform.
The
XFile
class that most people use would end up being a read-only interface to retrieve data from the file, and the different backing implementations would extend it.(This would also allow us to return
XFile
as the base-class name for all the objects, instead of being the top-most classname, which is weird from an OOP standpoint!)Some questions:
The text was updated successfully, but these errors were encountered: