Skip to content

Commit 40b14c2

Browse files
committed
Fix for breaking change in flutter_file_picker
1 parent 2fd2ec2 commit 40b14c2

3 files changed

Lines changed: 6 additions & 5 deletions

File tree

lib/main_menu/projects/new_project_dialog.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,9 @@ class NewProjectDialogState extends ConsumerState<NewProjectDialog> {
160160
padding: const EdgeInsets.only(top: 24, left: 8),
161161
child: ElevatedButton.icon(
162162
onPressed: () async {
163-
final String? picked = await FilePicker.platform
164-
.getDirectoryPath(dialogTitle: "Pick project location");
163+
final String? picked = await FilePicker.getDirectoryPath(
164+
dialogTitle: "Pick project location",
165+
);
165166
if (picked == null) return;
166167

167168
setState(() {

lib/main_menu/settings/java/java_picker.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ class _JavaPickerState extends ConsumerState<JavaPicker> {
371371
}
372372

373373
Future<void> onCustom() async {
374-
final FilePickerResult? browsed = await FilePicker.platform.pickFiles(
374+
final FilePickerResult? browsed = await FilePicker.pickFiles(
375375
dialogTitle: "Select Java executable",
376376
// Specifically mention this, because we can't use FileType.custom, which would be expected here.
377377
// This is because it doesn't support files with no extension, which is the case for executables on linux.

lib/project_view/configs/views/base.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ class PathPickerButton extends StatelessWidget {
114114
// - Linux will crash on this, if the path contains any special characters
115115
// (I have submitted a PR to the file_picker library that will fix this: https://github.com/miguelpruivo/flutter_file_picker/pull/1963 )
116116
// - Windows will crash on this, if the directory does not exist
117-
picked = await FilePicker.platform.getDirectoryPath(
117+
picked = await FilePicker.getDirectoryPath(
118118
dialogTitle: dialogTitle,
119119
initialDirectory: initialDirectory,
120120
);
@@ -124,7 +124,7 @@ class PathPickerButton extends StatelessWidget {
124124
// ignore: avoid_catches_without_on_clauses
125125
} catch (_) {
126126
// So if it crashed, we try again, but without an initialDirectory:
127-
picked = await FilePicker.platform.getDirectoryPath(
127+
picked = await FilePicker.getDirectoryPath(
128128
dialogTitle: dialogTitle,
129129
);
130130
}

0 commit comments

Comments
 (0)