It currently returns the cached version of the file. I don't need the file just the actual file path.
It will be very helpful to have a method to get only the actual file paths without copying the file into the cache.
@hirokbanik you can’t have paths if the files don’t exist. 👀
Currently on iOS it is _not possible_ to have absolute paths for files as those are protected by OS. Either you have an URI which is useless for Flutter or you have to cache the file and the use its path — that’s what the plugin is currently doing.
On Android, until 2.0.0, I was using the absolute path of the file but that wasn’t reliable, specially since Sdk 29 as Android team encourage you to not try to use absolute paths. Once again, either use an URI to access the original file or cache a copy and use the absolute path.
So, TL;DR what you’re asking won’t be possible from now on but caching the file shouldn’t be any issue (and if the files are remotely stored you _must_ cache anyway) but if it bothers you, you can always call cleanTemporaryFiles() when you’re done.
As an alternative, you can use any of the file_picker versions below 2.0.0 to get your desired behavior, but I wouldn’t recommend you to do so in the long term as you might be losing some new features and bug fixes.
Thank you for your comprehension.
Thanks for replying,
Actually I'm making a file sharing app and loading large file (lets say 500MB or 1GB) into cache crashes the app. Works fine with smaller files around 50MB
For my use case will try version below 2.0.
@hirokbanik what version are you using when the crash happens and what’s the stack trace? You shouldn’t have any issue with caching unless the phone doesn’t have enough available storage for it. Memory wise, the operation is done in batches to prevent out of memory exceptions.
Edit: you probably have withData se to true. You shouldn’t use it unless you really need the file to be available on memory or else might result in a crash. See that property just as a helper.
Earlier I was using 2.0.0. Now upgrading to 2
0.6 seems to fix the issue. The app doesn't crash anymore.
Thanks.. 😇
@hirokbanik yeap, that’s because I have only introduced batched file creation on 2.0.3 I believe, precisely because of bigger files. :)
Thanks..
Most helpful comment
@hirokbanik yeap, that’s because I have only introduced batched file creation on 2.0.3 I believe, precisely because of bigger files. :)