* If picker is canceled in `getFile()`, it should return `null`
This commit is contained in:
Miguel Ruivo 2019-03-16 12:18:10 +00:00 committed by GitHub
parent 094d0cd03b
commit 43796d2a21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 3 deletions

View File

@ -1,3 +1,7 @@
## 1.3.2
**Bug fix:** Returns a `null` value in the `getFile()` when the picker is canceled.
## 1.3.1
**Bug fix:** Fixes an issue on Android, where other activity would try to call `FilePicker`'s result object when it shouldn't.

View File

@ -10,7 +10,7 @@ A package that allows you to use a native file explorer to pick single or multip
First, add *file_picker* as a dependency in [your pubspec.yaml file](https://flutter.io/platform-plugins/).
```
file_picker: ^1.3.1
file_picker: ^1.3.2
```
### Android
Add `<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>` to your app `AndroidManifest.xml` file. This is required due to file caching when a path is required from a remote file (eg. Google Drive).

View File

@ -40,7 +40,7 @@ class FilePicker {
/// you are planing to create a `File` for the returned path.
static Future<File> getFile({FileType type = FileType.ANY, String fileExtension}) async {
final String filePath = await _getPath(_handleType(type, fileExtension), false);
return File(filePath);
return filePath != null ? File(filePath) : null;
}
static Future<dynamic> _getPath(String type, bool multipleSelection) async {

View File

@ -2,7 +2,7 @@ name: file_picker
description: A package that allows you to use a native file explorer to pick single or multiple absolute file paths, with extensions filtering support.
author: Miguel Ruivo <miguelpruivo@outlook.com>
homepage: https://github.com/miguelpruivo/plugins_flutter_file_picker
version: 1.3.1
version: 1.3.2
dependencies: