Skip to content

Commit

Permalink
Fix "Null check operator used on a null value" in `file_picker_deskto…
Browse files Browse the repository at this point in the history
…p.dart` (#1093)
  • Loading branch information
nilsreichardt authored Sep 26, 2023
1 parent 56128ba commit 21d4d1f
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ class FilePickerDesktop extends FilePickerImplementation {

Future<List<LocalFile>> selectMultipleFiles() async {
final fileChooserResult =
(await file_picker.FilePicker.platform.pickFiles(allowMultiple: true))!;
if (fileChooserResult.count == 0) return [];
(await file_picker.FilePicker.platform.pickFiles(allowMultiple: true));
if (fileChooserResult == null || fileChooserResult.count == 0) return [];
log('fileChooserResult.paths: ${fileChooserResult.paths}');
final files =
fileChooserResult.paths.map((path) => LocalFileIo.fromFile(File(path!)));
Expand All @@ -68,8 +68,8 @@ Future<List<LocalFile>> selectMultipleFiles() async {

Future<LocalFile?> selectSingleFile() async {
final fileChooserResult =
(await file_picker.FilePicker.platform.pickFiles(allowMultiple: false))!;
if (fileChooserResult.count == 0) return null;
(await file_picker.FilePicker.platform.pickFiles(allowMultiple: false));
if (fileChooserResult == null || fileChooserResult.count == 0) return null;
final files =
fileChooserResult.paths.map((path) => LocalFileIo.fromFile(File(path!)));
return files.toList()[0];
Expand Down

0 comments on commit 21d4d1f

Please sign in to comment.