From 95afb9cde70dc698366dcffb592a9fbfa577c272 Mon Sep 17 00:00:00 2001 From: Miller Adulu Date: Fri, 19 Mar 2021 20:53:46 +0300 Subject: [PATCH] Import null safe file picker --- lib/widgets/toolbar.dart | 4 ++-- pubspec.lock | 2 +- pubspec.yaml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/widgets/toolbar.dart b/lib/widgets/toolbar.dart index c176a809..2f6e0115 100644 --- a/lib/widgets/toolbar.dart +++ b/lib/widgets/toolbar.dart @@ -574,9 +574,9 @@ class _ImageButtonState extends State { fsType: FilesystemType.file, fileTileSelectMode: FileTileSelectMode.wholeTile, ); - if (filePath.isEmpty) return ''; + if (filePath != null && filePath.isEmpty) return ''; - final File file = File(filePath); + final File file = File(filePath!); String url = await widget.onImagePickCallback!(file); print('Image uploaded and its url is $url'); return url; diff --git a/pubspec.lock b/pubspec.lock index c49f28c0..aac0d9cd 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -91,7 +91,7 @@ packages: name: filesystem_picker url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "2.0.0-nullsafety.0" flutter: dependency: "direct main" description: flutter diff --git a/pubspec.yaml b/pubspec.yaml index e7425b6b..682eb412 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -14,7 +14,7 @@ dependencies: sdk: flutter collection: ^1.15.0 file_picker: ^3.0.0 - filesystem_picker: ^1.0.4 + filesystem_picker: ^2.0.0-nullsafety.0 flutter_colorpicker: ^0.4.0-nullsafety.0 flutter_keyboard_visibility: ^5.0.0 image_picker: ^0.7.3