From d2d4de7bf870ee41840ed88975fbc9a519d1984b Mon Sep 17 00:00:00 2001 From: markgrancapal Date: Wed, 11 Nov 2020 22:42:12 +0800 Subject: [PATCH] Fix null PlatformFIle.extension error when called on Web --- CHANGELOG.md | 3 +++ lib/src/platform_file.dart | 2 +- pubspec.yaml | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e19eff1..afb4c7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 2.0.13 +Updates `extension` helper getter to use the `name` property instead of `path`, since the latest isn't available on the Web, hence, the extension wouldn't be as well. Thank you @markgrancapal. + ## 2.0.12 Android: diff --git a/lib/src/platform_file.dart b/lib/src/platform_file.dart index 2ddebd2..86bcb51 100644 --- a/lib/src/platform_file.dart +++ b/lib/src/platform_file.dart @@ -32,5 +32,5 @@ class PlatformFile { final int size; /// File extension for this file. - String get extension => path?.split('.')?.last; + String get extension => name?.split('.')?.last; } diff --git a/pubspec.yaml b/pubspec.yaml index 7033c0e..85a8d4c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,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 extension filtering support. homepage: https://github.com/miguelpruivo/plugins_flutter_file_picker -version: 2.0.12 +version: 2.0.13 dependencies: flutter: