Skip to content

Commit

Permalink
[image_picker] Update README for image_picker's retrieveLostData() to…
Browse files Browse the repository at this point in the history
… support multiple files (flutter#4336)
  • Loading branch information
reez12g authored Sep 15, 2021
1 parent 5f1c83e commit d217642
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
4 changes: 4 additions & 0 deletions packages/image_picker/image_picker/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.8.4+1

* Fix README Example for `ImagePickerCache` to cache multiple files.

## 0.8.4

* Update `ImagePickerCache` to cache multiple files.
Expand Down
14 changes: 4 additions & 10 deletions packages/image_picker/image_picker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,10 @@ Future<void> getLostData() async {
if (response.isEmpty) {
return;
}
if (response.file != null) {
setState(() {
if (response.type == RetrieveType.video) {
_handleVideo(response.file);
} else {
_handleImage(response.file);
}
});
if (response.files != null) {
for(final XFile file in response.files) {
_handleFile(file);
}
} else {
_handleError(response.exception);
}
Expand All @@ -78,8 +74,6 @@ Future<void> getLostData() async {

There's no way to detect when this happens, so calling this method at the right place is essential. We recommend to wire this into some kind of start up check. Please refer to the example app to see how we used it.

On Android, `retrieveLostData` will only get the last picked image when picking multiple images, see: [#84634](https://github.com/flutter/flutter/issues/84634).

## Migrating to 0.8.2+

Starting with version **0.8.2** of the image_picker plugin, new methods have been added for picking files that return `XFile` instances (from the [cross_file](https://pub.dev/packages/cross_file) package) rather than the plugin's own `PickedFile` instances. While the previous methods still exist, it is already recommended to start migrating over to their new equivalents. Eventually, `PickedFile` and the methods that return instances of it will be deprecated and removed.
Expand Down
2 changes: 1 addition & 1 deletion packages/image_picker/image_picker/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Flutter plugin for selecting images from the Android and iOS image
library, and taking new pictures with the camera.
repository: https://github.com/flutter/plugins/tree/master/packages/image_picker/image_picker
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+image_picker%22
version: 0.8.4
version: 0.8.4+1

environment:
sdk: ">=2.12.0 <3.0.0"
Expand Down

0 comments on commit d217642

Please sign in to comment.