Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit db2f8fc

Browse files
committed
[image_picker] Update README for image_picker's retrieveLostData() to support multiple files
1 parent 5f1c83e commit db2f8fc

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

packages/image_picker/image_picker/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.8.4+1
2+
3+
* Fix README Example for `ImagePickerCache` to cache multiple files.
4+
15
## 0.8.4
26

37
* Update `ImagePickerCache` to cache multiple files.

packages/image_picker/image_picker/README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,16 @@ Future<void> getLostData() async {
6363
return;
6464
}
6565
if (response.file != null) {
66-
setState(() {
67-
if (response.type == RetrieveType.video) {
68-
_handleVideo(response.file);
69-
} else {
70-
_handleImage(response.file);
71-
}
72-
});
66+
if (response.files.length >= 2 ) {
67+
_imageFileList = response.files
68+
} else {
69+
setState(() {
70+
if (response.type == RetrieveType.video) {
71+
_handleVideo(response.file);
72+
} else {
73+
_handleImage(response.file);
74+
}
75+
}});
7376
} else {
7477
_handleError(response.exception);
7578
}
@@ -78,8 +81,6 @@ Future<void> getLostData() async {
7881

7982
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.
8083

81-
On Android, `retrieveLostData` will only get the last picked image when picking multiple images, see: [#84634](https://github.com/flutter/flutter/issues/84634).
82-
8384
## Migrating to 0.8.2+
8485

8586
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.

packages/image_picker/image_picker/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: Flutter plugin for selecting images from the Android and iOS image
33
library, and taking new pictures with the camera.
44
repository: https://github.com/flutter/plugins/tree/master/packages/image_picker/image_picker
55
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+image_picker%22
6-
version: 0.8.4
6+
version: 0.8.4+1
77

88
environment:
99
sdk: ">=2.12.0 <3.0.0"

0 commit comments

Comments
 (0)