Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit 32ca9d8

Browse files
adpinolaVanesaOshiro
authored andcommitted
update version to 0.9.1
1 parent f18c7cf commit 32ca9d8

File tree

5 files changed

+13
-11
lines changed

5 files changed

+13
-11
lines changed

packages/file_selector/file_selector_macos/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## 0.9.0+4
1+
## 0.9.1
22

33
* Adds `getDirectoryPaths` implementation.
44

packages/file_selector/file_selector_macos/example/lib/get_multiple_directories_page.dart

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,14 @@ class GetMultipleDirectoriesPage extends StatelessWidget {
1717
await FileSelectorPlatform.instance.getDirectoryPaths(
1818
confirmButtonText: confirmButtonText,
1919
);
20-
if (directoriesPaths == null || directoriesPaths.isEmpty) {
20+
if (directoriesPaths.isEmpty) {
2121
// Operation was canceled by the user.
2222
return;
2323
}
24-
String paths = '';
25-
for (final String? path in directoriesPaths) {
26-
paths += '${path!} \n';
27-
}
2824
await showDialog<void>(
2925
context: context,
30-
builder: (BuildContext context) => TextDisplay(paths),
26+
builder: (BuildContext context) =>
27+
TextDisplay(directoriesPaths.join('\n')),
3128
);
3229
}
3330

packages/file_selector/file_selector_macos/lib/file_selector_macos.dart

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ class FileSelectorMacOS extends FileSelectorPlatform {
3535
'multiple': false,
3636
},
3737
);
38-
return path == null ? null : XFile(path.first);
38+
final String? filePath = _firstOrNull(path);
39+
return filePath == null ? null : XFile(filePath);
3940
}
4041

4142
@override
@@ -86,7 +87,7 @@ class FileSelectorMacOS extends FileSelectorPlatform {
8687
'confirmButtonText': confirmButtonText,
8788
},
8889
);
89-
return pathList?.first;
90+
return _firstOrNull(pathList);
9091
}
9192

9293
@override
@@ -143,4 +144,8 @@ class FileSelectorMacOS extends FileSelectorPlatform {
143144

144145
return allowedTypes;
145146
}
147+
148+
String? _firstOrNull(List<String>? list) {
149+
return (list?.isEmpty ?? true) ? null : list?.first;
150+
}
146151
}

packages/file_selector/file_selector_macos/macos/Classes/FileSelectorPlugin.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public class FileSelectorPlugin: NSObject, FlutterPlugin {
7373
configure(panel: panel, with: arguments)
7474
configure(openPanel: panel, with: arguments, choosingDirectory: choosingDirectory)
7575
panelController.display(panel, for: viewProvider.view?.window) { (selection: [URL]?) in
76-
result(selection?.map({ item in item.path }))
76+
result(selection?.map({ item in item.path }))
7777
}
7878
case saveMethod:
7979
let panel = NSSavePanel()

packages/file_selector/file_selector_macos/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: file_selector_macos
22
description: macOS implementation of the file_selector plugin.
33
repository: https://github.com/flutter/plugins/tree/main/packages/file_selector/file_selector_macos
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+file_selector%22
5-
version: 0.9.0+4
5+
version: 0.9.1
66

77
environment:
88
sdk: ">=2.12.0 <3.0.0"

0 commit comments

Comments
 (0)