diff --git a/file_picker_web/CHANGELOG.md b/file_picker_web/CHANGELOG.md index 5416716..0bd9387 100644 --- a/file_picker_web/CHANGELOG.md +++ b/file_picker_web/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.0.2+1 + +Fix custom filter String creation. + ## 1.0.2 Addresses an issue that would cause dot being required on filters for web (#343) diff --git a/file_picker_web/lib/file_picker_web.dart b/file_picker_web/lib/file_picker_web.dart index 7141462..6e6f72b 100644 --- a/file_picker_web/lib/file_picker_web.dart +++ b/file_picker_web/lib/file_picker_web.dart @@ -17,10 +17,8 @@ class FilePicker extends FilePickerPlatform { /// [allowedExtensions] can be used (eg. `[.jpg, .pdf]`) to restrict picking types /// /// Returns a `List` - static Future> getMultiFile( - {FileType type = FileType.any, List allowedExtensions}) async { - return await _instance.getFiles( - type: type, allowMultiple: true, allowedExtensions: allowedExtensions); + static Future> getMultiFile({FileType type = FileType.any, List allowedExtensions}) async { + return await _instance.getFiles(type: type, allowMultiple: true, allowedExtensions: allowedExtensions); } /// Opens browser file picker window to select a single file. @@ -28,11 +26,8 @@ class FilePicker extends FilePickerPlatform { /// [allowedExtensions] can be used (eg. `[.jpg, .pdf]`) to restrict picking types /// /// Returns a `html.File` - static Future getFile( - {FileType type = FileType.any, List allowedExtensions}) async { - return (await _instance.getFiles( - type: type, allowedExtensions: allowedExtensions)) - .first; + static Future getFile({FileType type = FileType.any, List allowedExtensions}) async { + return (await _instance.getFiles(type: type, allowedExtensions: allowedExtensions)).first; } @override @@ -46,8 +41,7 @@ class FilePicker extends FilePickerPlatform { html.InputElement uploadInput = html.FileUploadInputElement(); uploadInput.multiple = allowMultiple; uploadInput.accept = _fileType(type, allowedExtensions); - uploadInput.onChange - .listen((event) => pickedFiles.complete(uploadInput.files)); + uploadInput.onChange.listen((event) => pickedFiles.complete(uploadInput.files)); uploadInput.click(); return await pickedFiles.future; } @@ -70,8 +64,7 @@ class FilePicker extends FilePickerPlatform { return 'video/*|image/*'; case FileType.custom: - return allowedExtensions - .reduce((value, element) => '.$value,.$element'); + return allowedExtensions.fold('', (prev, next) => '${prev.isEmpty ? '' : '$prev,'} .$next'); break; } return ''; diff --git a/file_picker_web/pubspec.yaml b/file_picker_web/pubspec.yaml index 1698c3f..03def2f 100644 --- a/file_picker_web/pubspec.yaml +++ b/file_picker_web/pubspec.yaml @@ -1,7 +1,7 @@ name: file_picker_web description: Web platform implementation of file_picker. Provides a way to pick files with filter support for Web. homepage: https://github.com/miguelpruivo/flutter_file_picker/tree/master/file_picker_web -version: 1.0.2 +version: 1.0.2+1 environment: sdk: ">=2.7.0 <3.0.0"