@@ -10,10 +10,11 @@ A Flutter plugin that manages files and interactions with file dialogs.
10
10
| -------------| --------| -------| --------| -----| -------------|
11
11
| ** Support** | iOS 9+ | Any | 10.11+ | Any | Windows 10+ |
12
12
13
- ## Usage
13
+ # Usage
14
+
14
15
To use this plugin, add ` file_selector ` as a [ dependency in your pubspec.yaml file] ( https://flutter.dev/platform-plugins/ ) .
15
16
16
- ### macOS
17
+ ## macOS
17
18
18
19
You will need to [ add an entitlement] [ entitlement ] for either read-only access:
19
20
``` xml
@@ -27,11 +28,23 @@ or read/write access:
27
28
```
28
29
depending on your use case.
29
30
30
- ### Examples
31
+ # Feature supported platform
32
+ Features support by platform:
33
+
34
+ | Feature | iOS | Linux | macOS | Windows | Android |
35
+ | -------------------- | --------- | --------- | --------- | ----------- | -------- |
36
+ | Open a single file | ✔️ | ✔️ | ✔️ | ✔️ | ❌ |
37
+ | Open multiple files | ✔️ | ✔️ | ✔️ | ✔️ | ❌ |
38
+ | Saving a file | ❌ | ✔️ | ✔️ | ✔️ | ❌ |
39
+ | Get directory path | ❌ | ✔️ | ✔️ | ✔️ | ❌ |
40
+
41
+ # Example
42
+
31
43
Here are small examples that show you how to use the API.
32
44
Please also take a look at our [ example] [ example ] app.
33
45
34
- #### Open a single file
46
+ ## Open a single file
47
+
35
48
<? code-excerpt "open_image_page.dart (SingleOpen)"?>
36
49
``` dart
37
50
final XTypeGroup typeGroup = XTypeGroup(
@@ -42,7 +55,7 @@ final XFile? file =
42
55
await openFile(acceptedTypeGroups: <XTypeGroup>[typeGroup]);
43
56
```
44
57
45
- #### Open multiple files at once
58
+ ## Open multiple files at once
46
59
<? code-excerpt "open_multiple_images_page.dart (MultiOpen)"?>
47
60
``` dart
48
61
final XTypeGroup jpgsTypeGroup = XTypeGroup(
@@ -59,7 +72,8 @@ final List<XFile> files = await openFiles(acceptedTypeGroups: <XTypeGroup>[
59
72
]);
60
73
```
61
74
62
- #### Saving a file
75
+ ## Saving a file
76
+
63
77
<? code-excerpt "readme_standalone_excerpts.dart (Save)"?>
64
78
``` dart
65
79
const String fileName = 'suggested_name.txt';
@@ -76,6 +90,15 @@ final XFile textFile =
76
90
await textFile.saveTo(path);
77
91
```
78
92
93
+ ## Get directory path
94
+
95
+ <? code-excerpt "get_directory_page.dart (GetDirectory)"?>
96
+ ``` dart
97
+ const String confirmButtonText = 'Choose';
98
+ final String? directoryPath = await getDirectoryPath(
99
+ confirmButtonText: confirmButtonText,
100
+ );
101
+ ```
79
102
### Filtering by file types
80
103
81
104
Different platforms support different type group filter options. To avoid
@@ -93,4 +116,4 @@ pass different `XTypeGroup`s based on `Platform`.
93
116
† ` mimeTypes ` are not supported on version of macOS earlier than 11 (Big Sur).
94
117
95
118
[ example ] :./example
96
- [ entitlement ] : https://docs.flutter.dev/desktop#entitlements-and-the-app-sandbox
119
+ [ entitlement ] : https://docs.flutter.dev/desktop#entitlements-and-the-app-sandbox
0 commit comments