[file_selector] Remove uses of `macUTIs` (#3859)
A change to replace `macUTIs` with `uniformTypeIdentifiers` (with `macUTIs` staying as an alias for compatibility) landed a while ago in the platform interface, but the rest of the packages were never updated to use it. This removes uses from all other packages, in preparation for formally deprecating `macUTIs`.
Mostly completes https://github.com/flutter/flutter/issues/103743
diff --git a/packages/file_selector/file_selector/CHANGELOG.md b/packages/file_selector/file_selector/CHANGELOG.md
index febebfd..ed6ce16 100644
--- a/packages/file_selector/file_selector/CHANGELOG.md
+++ b/packages/file_selector/file_selector/CHANGELOG.md
@@ -1,5 +1,6 @@
-## NEXT
+## 0.9.2+5
+* Updates references to the deprecated `macUTIs`.
* Aligns Dart and Flutter SDK constraints.
## 0.9.2+4
diff --git a/packages/file_selector/file_selector/README.md b/packages/file_selector/file_selector/README.md
index d5878e2..3fc0f14 100644
--- a/packages/file_selector/file_selector/README.md
+++ b/packages/file_selector/file_selector/README.md
@@ -99,12 +99,12 @@
filters that cover all platforms you are targeting, or that you conditionally
pass different `XTypeGroup`s based on `Platform`.
-| | Linux | macOS | Web | Windows |
-|----------------|-------|--------|-----|-------------|
-| `extensions` | ✔️ | ✔️ | ✔️ | ✔️ |
-| `mimeTypes` | ✔️ | ✔️† | ✔️ | |
-| `macUTIs` | | ✔️ | | |
-| `webWildCards` | | | ✔️ | |
+| | iOS | Linux | macOS | Web | Windows |
+|--------------------------|-----|-------|--------|-----|-------------|
+| `extensions` | | ✔️ | ✔️ | ✔️ | ✔️ |
+| `mimeTypes` | | ✔️ | ✔️† | ✔️ | |
+| `uniformTypeIdentifiers` | ✔️ | | ✔️ | | |
+| `webWildCards` | | | | ✔️ | |
† `mimeTypes` are not supported on version of macOS earlier than 11 (Big Sur).
@@ -118,4 +118,4 @@
| Choose a directory | Pick a folder and get its path | ❌ | ✔️ | ✔️ | ✔️ | ❌ |
[example]:./example
-[entitlement]: https://docs.flutter.dev/desktop#entitlements-and-the-app-sandbox
\ No newline at end of file
+[entitlement]: https://docs.flutter.dev/desktop#entitlements-and-the-app-sandbox
diff --git a/packages/file_selector/file_selector/pubspec.yaml b/packages/file_selector/file_selector/pubspec.yaml
index 5a8e910..becf6d3 100644
--- a/packages/file_selector/file_selector/pubspec.yaml
+++ b/packages/file_selector/file_selector/pubspec.yaml
@@ -3,7 +3,7 @@
directories, using native file selection UI.
repository: https://github.com/flutter/packages/tree/main/packages/file_selector/file_selector
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+file_selector%22
-version: 0.9.2+4
+version: 0.9.2+5
environment:
sdk: ">=2.17.0 <4.0.0"
@@ -27,7 +27,7 @@
file_selector_ios: ^0.5.0
file_selector_linux: ^0.9.0
file_selector_macos: ^0.9.0
- file_selector_platform_interface: ^2.2.0
+ file_selector_platform_interface: ^2.3.0
file_selector_web: ^0.9.0
file_selector_windows: ^0.9.0
flutter:
diff --git a/packages/file_selector/file_selector_ios/CHANGELOG.md b/packages/file_selector/file_selector_ios/CHANGELOG.md
index 568b6ce..8a48d5b 100644
--- a/packages/file_selector/file_selector_ios/CHANGELOG.md
+++ b/packages/file_selector/file_selector_ios/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 0.5.1+4
+
+* Updates references to the deprecated `macUTIs`.
+
## 0.5.1+3
* Updates pigeon to fix warnings with clang 15.
diff --git a/packages/file_selector/file_selector_ios/example/lib/open_image_page.dart b/packages/file_selector/file_selector_ios/example/lib/open_image_page.dart
index a89c1bf..e4fd5dd 100644
--- a/packages/file_selector/file_selector_ios/example/lib/open_image_page.dart
+++ b/packages/file_selector/file_selector_ios/example/lib/open_image_page.dart
@@ -18,7 +18,7 @@
const XTypeGroup typeGroup = XTypeGroup(
label: 'images',
extensions: <String>['jpg', 'png'],
- macUTIs: <String>['public.image'],
+ uniformTypeIdentifiers: <String>['public.image'],
);
final XFile? file = await FileSelectorPlatform.instance
.openFile(acceptedTypeGroups: <XTypeGroup>[typeGroup]);
diff --git a/packages/file_selector/file_selector_ios/example/lib/open_multiple_images_page.dart b/packages/file_selector/file_selector_ios/example/lib/open_multiple_images_page.dart
index a101a45..cdbf5f2 100644
--- a/packages/file_selector/file_selector_ios/example/lib/open_multiple_images_page.dart
+++ b/packages/file_selector/file_selector_ios/example/lib/open_multiple_images_page.dart
@@ -18,12 +18,12 @@
const XTypeGroup jpgsTypeGroup = XTypeGroup(
label: 'JPEGs',
extensions: <String>['jpg', 'jpeg'],
- macUTIs: <String>['public.jpeg'],
+ uniformTypeIdentifiers: <String>['public.jpeg'],
);
const XTypeGroup pngTypeGroup = XTypeGroup(
label: 'PNGs',
extensions: <String>['png'],
- macUTIs: <String>['public.png'],
+ uniformTypeIdentifiers: <String>['public.png'],
);
final List<XFile> files = await FileSelectorPlatform.instance
.openFiles(acceptedTypeGroups: <XTypeGroup>[
diff --git a/packages/file_selector/file_selector_ios/example/lib/open_text_page.dart b/packages/file_selector/file_selector_ios/example/lib/open_text_page.dart
index 14ec0ea..f606fdc 100644
--- a/packages/file_selector/file_selector_ios/example/lib/open_text_page.dart
+++ b/packages/file_selector/file_selector_ios/example/lib/open_text_page.dart
@@ -15,7 +15,7 @@
const XTypeGroup typeGroup = XTypeGroup(
label: 'text',
extensions: <String>['txt', 'json'],
- macUTIs: <String>['public.text'],
+ uniformTypeIdentifiers: <String>['public.text'],
);
final XFile? file = await FileSelectorPlatform.instance
.openFile(acceptedTypeGroups: <XTypeGroup>[typeGroup]);
diff --git a/packages/file_selector/file_selector_ios/lib/file_selector_ios.dart b/packages/file_selector/file_selector_ios/lib/file_selector_ios.dart
index e75f67e..22349b6 100644
--- a/packages/file_selector/file_selector_ios/lib/file_selector_ios.dart
+++ b/packages/file_selector/file_selector_ios/lib/file_selector_ios.dart
@@ -53,11 +53,11 @@
if (typeGroup.allowsAny) {
return <String>[];
}
- if (typeGroup.macUTIs?.isEmpty ?? true) {
+ if (typeGroup.uniformTypeIdentifiers?.isEmpty ?? true) {
throw ArgumentError('The provided type group $typeGroup should either '
- 'allow all files, or have a non-empty "macUTIs"');
+ 'allow all files, or have a non-empty "uniformTypeIdentifiers"');
}
- allowedUTIs.addAll(typeGroup.macUTIs!);
+ allowedUTIs.addAll(typeGroup.uniformTypeIdentifiers!);
}
return allowedUTIs;
}
diff --git a/packages/file_selector/file_selector_ios/pubspec.yaml b/packages/file_selector/file_selector_ios/pubspec.yaml
index aa94300..944f467 100644
--- a/packages/file_selector/file_selector_ios/pubspec.yaml
+++ b/packages/file_selector/file_selector_ios/pubspec.yaml
@@ -2,7 +2,7 @@
description: iOS implementation of the file_selector plugin.
repository: https://github.com/flutter/packages/tree/main/packages/file_selector/file_selector_ios
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+file_selector%22
-version: 0.5.1+3
+version: 0.5.1+4
environment:
sdk: ">=2.18.0 <4.0.0"
@@ -17,7 +17,7 @@
pluginClass: FFSFileSelectorPlugin
dependencies:
- file_selector_platform_interface: ^2.2.0
+ file_selector_platform_interface: ^2.3.0
flutter:
sdk: flutter
diff --git a/packages/file_selector/file_selector_ios/test/file_selector_ios_test.dart b/packages/file_selector/file_selector_ios/test/file_selector_ios_test.dart
index e10ad17..6d3c3c6 100644
--- a/packages/file_selector/file_selector_ios/test/file_selector_ios_test.dart
+++ b/packages/file_selector/file_selector_ios/test/file_selector_ios_test.dart
@@ -40,14 +40,14 @@
label: 'text',
extensions: <String>['txt'],
mimeTypes: <String>['text/plain'],
- macUTIs: <String>['public.text'],
+ uniformTypeIdentifiers: <String>['public.text'],
);
const XTypeGroup groupTwo = XTypeGroup(
label: 'image',
extensions: <String>['jpg'],
mimeTypes: <String>['image/jpg'],
- macUTIs: <String>['public.image'],
+ uniformTypeIdentifiers: <String>['public.image'],
webWildCards: <String>['image/*']);
await plugin.openFile(acceptedTypeGroups: <XTypeGroup>[group, groupTwo]);
@@ -56,7 +56,7 @@
final FileSelectorConfig config =
result.captured[0] as FileSelectorConfig;
- // iOS only accepts macUTIs.
+ // iOS only accepts uniformTypeIdentifiers.
expect(listEquals(config.utis, <String>['public.text', 'public.image']),
isTrue);
expect(config.allowMultiSelection, isFalse);
@@ -92,14 +92,14 @@
label: 'text',
extensions: <String>['txt'],
mimeTypes: <String>['text/plain'],
- macUTIs: <String>['public.text'],
+ uniformTypeIdentifiers: <String>['public.text'],
);
const XTypeGroup groupTwo = XTypeGroup(
label: 'image',
extensions: <String>['jpg'],
mimeTypes: <String>['image/jpg'],
- macUTIs: <String>['public.image'],
+ uniformTypeIdentifiers: <String>['public.image'],
webWildCards: <String>['image/*']);
await plugin.openFiles(acceptedTypeGroups: <XTypeGroup>[group, groupTwo]);
@@ -108,7 +108,7 @@
final FileSelectorConfig config =
result.captured[0] as FileSelectorConfig;
- // iOS only accepts macUTIs.
+ // iOS only accepts uniformTypeIdentifiers.
expect(listEquals(config.utis, <String>['public.text', 'public.image']),
isTrue);
expect(config.allowMultiSelection, isTrue);
diff --git a/packages/file_selector/file_selector_linux/test/file_selector_linux_test.dart b/packages/file_selector/file_selector_linux/test/file_selector_linux_test.dart
index 53a549d..5127d28 100644
--- a/packages/file_selector/file_selector_linux/test/file_selector_linux_test.dart
+++ b/packages/file_selector/file_selector_linux/test/file_selector_linux_test.dart
@@ -38,15 +38,12 @@
label: 'text',
extensions: <String>['txt'],
mimeTypes: <String>['text/plain'],
- macUTIs: <String>['public.text'],
);
const XTypeGroup groupTwo = XTypeGroup(
label: 'image',
extensions: <String>['jpg'],
mimeTypes: <String>['image/jpg'],
- macUTIs: <String>['public.image'],
- webWildCards: <String>['image/*'],
);
await plugin.openFile(acceptedTypeGroups: <XTypeGroup>[group, groupTwo]);
@@ -144,15 +141,12 @@
label: 'text',
extensions: <String>['txt'],
mimeTypes: <String>['text/plain'],
- macUTIs: <String>['public.text'],
);
const XTypeGroup groupTwo = XTypeGroup(
label: 'image',
extensions: <String>['jpg'],
mimeTypes: <String>['image/jpg'],
- macUTIs: <String>['public.image'],
- webWildCards: <String>['image/*'],
);
await plugin.openFiles(acceptedTypeGroups: <XTypeGroup>[group, groupTwo]);
@@ -250,15 +244,12 @@
label: 'text',
extensions: <String>['txt'],
mimeTypes: <String>['text/plain'],
- macUTIs: <String>['public.text'],
);
const XTypeGroup groupTwo = XTypeGroup(
label: 'image',
extensions: <String>['jpg'],
mimeTypes: <String>['image/jpg'],
- macUTIs: <String>['public.image'],
- webWildCards: <String>['image/*'],
);
await plugin
diff --git a/packages/file_selector/file_selector_macos/CHANGELOG.md b/packages/file_selector/file_selector_macos/CHANGELOG.md
index f309e7b..2e9d4dc 100644
--- a/packages/file_selector/file_selector_macos/CHANGELOG.md
+++ b/packages/file_selector/file_selector_macos/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 0.9.1+1
+
+* Updates references to the deprecated `macUTIs`.
+
## 0.9.1
* Adds `getDirectoryPaths` implementation.
diff --git a/packages/file_selector/file_selector_macos/lib/file_selector_macos.dart b/packages/file_selector/file_selector_macos/lib/file_selector_macos.dart
index 0fd4457..293c1e2 100644
--- a/packages/file_selector/file_selector_macos/lib/file_selector_macos.dart
+++ b/packages/file_selector/file_selector_macos/lib/file_selector_macos.dart
@@ -121,17 +121,17 @@
// Reject a filter that isn't an allow-any, but doesn't set any
// macOS-supported filter categories.
if ((typeGroup.extensions?.isEmpty ?? true) &&
- (typeGroup.macUTIs?.isEmpty ?? true) &&
+ (typeGroup.uniformTypeIdentifiers?.isEmpty ?? true) &&
(typeGroup.mimeTypes?.isEmpty ?? true)) {
throw ArgumentError('Provided type group $typeGroup does not allow '
'all files, but does not set any of the macOS-supported filter '
- 'categories. At least one of "extensions", "macUTIs", or '
- '"mimeTypes" must be non-empty for macOS if anything is '
- 'non-empty.');
+ 'categories. At least one of "extensions", '
+ '"uniformTypeIdentifiers", or "mimeTypes" must be non-empty for '
+ 'macOS if anything is non-empty.');
}
allowedTypes.extensions.addAll(typeGroup.extensions ?? <String>[]);
allowedTypes.mimeTypes.addAll(typeGroup.mimeTypes ?? <String>[]);
- allowedTypes.utis.addAll(typeGroup.macUTIs ?? <String>[]);
+ allowedTypes.utis.addAll(typeGroup.uniformTypeIdentifiers ?? <String>[]);
}
return allowedTypes;
diff --git a/packages/file_selector/file_selector_macos/pubspec.yaml b/packages/file_selector/file_selector_macos/pubspec.yaml
index 6c6c365..65b055d 100644
--- a/packages/file_selector/file_selector_macos/pubspec.yaml
+++ b/packages/file_selector/file_selector_macos/pubspec.yaml
@@ -2,7 +2,7 @@
description: macOS implementation of the file_selector plugin.
repository: https://github.com/flutter/packages/tree/main/packages/file_selector/file_selector_macos
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+file_selector%22
-version: 0.9.1
+version: 0.9.1+1
environment:
sdk: ">=2.18.0 <4.0.0"
diff --git a/packages/file_selector/file_selector_macos/test/file_selector_macos_test.dart b/packages/file_selector/file_selector_macos/test/file_selector_macos_test.dart
index 6d33061..6450e6f 100644
--- a/packages/file_selector/file_selector_macos/test/file_selector_macos_test.dart
+++ b/packages/file_selector/file_selector_macos/test/file_selector_macos_test.dart
@@ -69,14 +69,14 @@
label: 'text',
extensions: <String>['txt'],
mimeTypes: <String>['text/plain'],
- macUTIs: <String>['public.text'],
+ uniformTypeIdentifiers: <String>['public.text'],
);
const XTypeGroup groupTwo = XTypeGroup(
label: 'image',
extensions: <String>['jpg'],
mimeTypes: <String>['image/jpg'],
- macUTIs: <String>['public.image'],
+ uniformTypeIdentifiers: <String>['public.image'],
webWildCards: <String>['image/*']);
await plugin.openFile(acceptedTypeGroups: <XTypeGroup>[group, groupTwo]);
@@ -165,14 +165,14 @@
label: 'text',
extensions: <String>['txt'],
mimeTypes: <String>['text/plain'],
- macUTIs: <String>['public.text'],
+ uniformTypeIdentifiers: <String>['public.text'],
);
const XTypeGroup groupTwo = XTypeGroup(
label: 'image',
extensions: <String>['jpg'],
mimeTypes: <String>['image/jpg'],
- macUTIs: <String>['public.image'],
+ uniformTypeIdentifiers: <String>['public.image'],
webWildCards: <String>['image/*']);
await plugin.openFiles(acceptedTypeGroups: <XTypeGroup>[group, groupTwo]);
@@ -256,14 +256,14 @@
label: 'text',
extensions: <String>['txt'],
mimeTypes: <String>['text/plain'],
- macUTIs: <String>['public.text'],
+ uniformTypeIdentifiers: <String>['public.text'],
);
const XTypeGroup groupTwo = XTypeGroup(
label: 'image',
extensions: <String>['jpg'],
mimeTypes: <String>['image/jpg'],
- macUTIs: <String>['public.image'],
+ uniformTypeIdentifiers: <String>['public.image'],
webWildCards: <String>['image/*']);
await plugin
@@ -324,13 +324,13 @@
label: 'text',
extensions: <String>['txt'],
mimeTypes: <String>['text/plain'],
- macUTIs: <String>['public.text'],
+ uniformTypeIdentifiers: <String>['public.text'],
),
const XTypeGroup(
label: 'image',
extensions: <String>['jpg'],
mimeTypes: <String>['image/jpg'],
- macUTIs: <String>['public.image'],
+ uniformTypeIdentifiers: <String>['public.image'],
),
const XTypeGroup(
label: 'any',
diff --git a/packages/file_selector/file_selector_web/pubspec.yaml b/packages/file_selector/file_selector_web/pubspec.yaml
index 9c0693f..478c9b6 100644
--- a/packages/file_selector/file_selector_web/pubspec.yaml
+++ b/packages/file_selector/file_selector_web/pubspec.yaml
@@ -17,7 +17,7 @@
fileName: file_selector_web.dart
dependencies:
- file_selector_platform_interface: ^2.2.0
+ file_selector_platform_interface: ^2.3.0
flutter:
sdk: flutter
flutter_web_plugins:
diff --git a/packages/file_selector/file_selector_web/test/utils_test.dart b/packages/file_selector/file_selector_web/test/utils_test.dart
index f9f3a41..e207f3d 100644
--- a/packages/file_selector/file_selector_web/test/utils_test.dart
+++ b/packages/file_selector/file_selector_web/test/utils_test.dart
@@ -56,7 +56,8 @@
test('throws for a type group that does not support web', () {
const List<XTypeGroup> acceptedTypes = <XTypeGroup>[
- XTypeGroup(label: 'text', macUTIs: <String>['public.text']),
+ XTypeGroup(
+ label: 'text', uniformTypeIdentifiers: <String>['public.text']),
];
expect(() => acceptedTypesToString(acceptedTypes), throwsArgumentError);
});
diff --git a/packages/file_selector/file_selector_windows/test/file_selector_windows_test.dart b/packages/file_selector/file_selector_windows/test/file_selector_windows_test.dart
index c7a380d..fbe3683 100644
--- a/packages/file_selector/file_selector_windows/test/file_selector_windows_test.dart
+++ b/packages/file_selector/file_selector_windows/test/file_selector_windows_test.dart
@@ -51,14 +51,13 @@
label: 'text',
extensions: <String>['txt'],
mimeTypes: <String>['text/plain'],
- macUTIs: <String>['public.text'],
);
const XTypeGroup groupTwo = XTypeGroup(
- label: 'image',
- extensions: <String>['jpg'],
- mimeTypes: <String>['image/jpg'],
- macUTIs: <String>['public.image']);
+ label: 'image',
+ extensions: <String>['jpg'],
+ mimeTypes: <String>['image/jpg'],
+ );
await plugin.openFile(acceptedTypeGroups: <XTypeGroup>[group, groupTwo]);
@@ -129,14 +128,13 @@
label: 'text',
extensions: <String>['txt'],
mimeTypes: <String>['text/plain'],
- macUTIs: <String>['public.text'],
);
const XTypeGroup groupTwo = XTypeGroup(
- label: 'image',
- extensions: <String>['jpg'],
- mimeTypes: <String>['image/jpg'],
- macUTIs: <String>['public.image']);
+ label: 'image',
+ extensions: <String>['jpg'],
+ mimeTypes: <String>['image/jpg'],
+ );
await plugin.openFiles(acceptedTypeGroups: <XTypeGroup>[group, groupTwo]);
@@ -266,14 +264,13 @@
label: 'text',
extensions: <String>['txt'],
mimeTypes: <String>['text/plain'],
- macUTIs: <String>['public.text'],
);
const XTypeGroup groupTwo = XTypeGroup(
- label: 'image',
- extensions: <String>['jpg'],
- mimeTypes: <String>['image/jpg'],
- macUTIs: <String>['public.image']);
+ label: 'image',
+ extensions: <String>['jpg'],
+ mimeTypes: <String>['image/jpg'],
+ );
await plugin
.getSavePath(acceptedTypeGroups: <XTypeGroup>[group, groupTwo]);