plux_media_picker 2.0.0
plux_media_picker: ^2.0.0 copied to clipboard
A Flutter plugin that provides a unified API to pick photos, videos, and files from the device's gallery, camera, and file system.
2.0.0 #
Breaking changes
PluxFile.uriis now documented as an opaque handle. On Android it is still the platform uri; on iOS it is a token backed by a bookmark, which is what keeps a document readable.copyToFiletakes thePluxFileinstead of a bare uri, so the copy can report the samesource.PluxFile.pathandPluxFile.sizeare nullable: null means "no file on disk" and "the source did not report a size", which used to be indistinguishable from an empty path and an empty file.PluxFilegainedmimeTypeandtype, both reported by the platform instead of guessed from the file name, andsource, which says whether the camera, the gallery or the file manager produced it.CameraMediaTypewas replaced byPluxMediaType(image,video,file), which also filters the gallery.CameraMediaType.anyis gone: it only ever worked on iOS.pickFilebecamepickFiles, returns a list and takesmaxLimit, so several documents can be picked at once.pickGallerytakes an optionalmediaTypeto show photos only or videos only, andasFile, which guarantees aPluxFile.pathso a caller that needs a real file does not have to follow up withcopyToFileper item.
Fixes
- A document picked on iOS stays readable. The security scoped url was handed to Dart as a string and rebuilt later; a rebuilt url does not carry the sandbox extension, so anything outside the app container - iCloud Drive, another provider - could not be opened. The plugin now keeps a bookmark, taken while the scope is open, and resolves it on every read.
clearCachereleases only the grants the plugin took, which it now records when picking a document. It used to walk every persisted uri permission the host app owned, including ones it knew nothing about, and it no longer wipes the state of a capture that is still in flight.- Decoding and re-encoding moved off the main thread. A multi-select of large photos ran the whole
BitmapFactoryround trip inside theActivityResultcallback, which is an ANR waiting to happen. - A gallery pick recovered by
getLostFilesis readable again: the photo picker grant dies with the process, so the bytes are now taken before the result is stored. A recovered file also reports itssource, so it can go back to the picker it came from. - A
readFileStreamsession that is never listened to is dropped after a minute instead of holding its channel until the engine detaches, and the redundant probe read before every stream is gone. - iOS clamps
qualityandmaxLimitthe way Android does;maxLimit: 0no longer means "unlimited" on one platform and "one item" on the other. pickCameraon iOS checks that a camera exists and can no longer be entered twice while the permission prompt is up, which used to drop the first completion.PluxMediaPickerExceptionhas a readabletoString().
1.0.3 #
Fixes
- Reading a file to the end no longer reports
MissingPluginException(No implementation found for method cancel on channel ...fileStreamEvents.N). Flutter closes an event stream by sending a finalcancelafterendOfStream, and the channel was being torn down before that call could be answered. The session is now released when the subscription is cancelled, which covers both a completed read and an early cancellation. Affected every finishedreadFileStreamon both platforms.
1.0.2 #
Breaking changes
getLostFilesnow returnsList<PluxFile>instead ofList<File>, so a recovered result keeps its uri, name and size and can be read withreadFileStream.readFileStreamtakes an optionalbufferSize(256 KB by default).pickFilenow throwsPluxMediaPickerExceptionon failure instead of returningnull.qualityapplies to images only: video is never re-encoded.- Removed the unused
ImageSourceenum.
Fewer copies
- A file is copied only when it has to be re-encoded. Videos, documents and images picked at full quality are now returned as the original uri instead of being duplicated into the cache.
- iOS opens documents in place (
asCopy: false) rather than copying every pick into the app. - A camera capture is compressed in place, so it no longer leaves a second file behind.
Streaming
PluxFile.uriis now always set, so every picked file can be read withreadFileStream, including gallery and camera results on iOS and recovered lost files.- Android reads on a background thread: the UI no longer freezes for the duration of the transfer, and cancelling a subscription actually stops the native reader.
- Chunks in flight are bounded, so a fast disk cannot queue the whole file in memory.
- Event channels are torn down when a stream ends, is cancelled or the engine detaches.
Fixes
- Files with the same name no longer overwrite each other in the cache.
- Compressed images are always written with a
.jpgname instead of keeping the source extension. - Calling a picker while another call is pending fails the new call instead of leaving the
previous
Futureunresolved forever. - Cancelling the camera or the file picker reports a cancellation instead of a save failure.
clearCacheremoves only the plugin's own files instead of the whole app cache.- The gallery no longer asks for a storage permission: the Android photo picker does not need
one.
pickGallery(maxLimit: 1)no longer hits the multi-select contract limit. - Fixed a data race while preparing several picked items on iOS, and the reported order now matches the order of selection.
- Large images fall back to a downsampled decode instead of running out of memory.
- iOS keeps the security scope open while measuring a file, and reports the actual failure code from the camera instead of a generic one.
- Android takes a persistable grant for picked documents, so the uri survives a process restart.
1.0.1 #
- Fixing Android bugs
1.0.0 #
- A Flutter plugin that provides a unified API to pick photos, videos, and files from the device's gallery, camera, and file system.