diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml
index 3f3b5def9..d2698f76f 100644
--- a/android/app/src/debug/AndroidManifest.xml
+++ b/android/app/src/debug/AndroidManifest.xml
@@ -8,6 +8,7 @@
+
@@ -15,6 +16,7 @@
+
diff --git a/android/app/src/main/AndroidManifest.foss.xml b/android/app/src/main/AndroidManifest.foss.xml
index a5333a944..abb2bb6a6 100644
--- a/android/app/src/main/AndroidManifest.foss.xml
+++ b/android/app/src/main/AndroidManifest.foss.xml
@@ -8,6 +8,7 @@
+
@@ -15,6 +16,7 @@
+
+
@@ -15,6 +16,7 @@
+
+
@@ -15,6 +16,7 @@
+
diff --git a/lib/utils/files.dart b/lib/utils/files.dart
index 8ed69a243..3469a4a94 100644
--- a/lib/utils/files.dart
+++ b/lib/utils/files.dart
@@ -3,6 +3,7 @@ import 'dart:io';
import 'dart:io' as file;
// Flutter imports:
+import 'package:device_info_plus/device_info_plus.dart';
import 'package:flutter/foundation.dart';
// Package imports:
@@ -39,11 +40,18 @@ Future?> pickFiles({
allowMultiple: allowMultiple,
);
} else {
- final permission = await (fileType == FileType.image && Platform.isIOS
- ? Permission.photos.request()
- : Permission.storage.request());
+ final androidInfo = await DeviceInfoPlugin().androidInfo;
+ PermissionStatus status;
- if (permission == PermissionStatus.granted) {
+ if (Platform.isIOS && fileType == FileType.image) {
+ status = await Permission.photos.request();
+ } else if (Platform.isAndroid && androidInfo.version.sdkInt >= 33) {
+ status = await Permission.photos.request();
+ } else {
+ status = await Permission.storage.request();
+ }
+
+ if (status == PermissionStatus.granted) {
return _pickFiles(
fileIndex: fileIndex,
fileType: fileType,
diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift
index 91ae4eeb9..99ae62b77 100644
--- a/macos/Flutter/GeneratedPluginRegistrant.swift
+++ b/macos/Flutter/GeneratedPluginRegistrant.swift
@@ -6,6 +6,7 @@ import FlutterMacOS
import Foundation
import desktop_drop
+import device_info_plus
import file_selector_macos
import in_app_purchase_storekit
import in_app_review
@@ -26,6 +27,7 @@ import window_manager
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
DesktopDropPlugin.register(with: registry.registrar(forPlugin: "DesktopDropPlugin"))
+ DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
InAppPurchasePlugin.register(with: registry.registrar(forPlugin: "InAppPurchasePlugin"))
InAppReviewPlugin.register(with: registry.registrar(forPlugin: "InAppReviewPlugin"))
diff --git a/pubspec.foss.yaml b/pubspec.foss.yaml
index 9d7c93e06..e39c7650a 100644
--- a/pubspec.foss.yaml
+++ b/pubspec.foss.yaml
@@ -89,6 +89,7 @@ dependencies:
# idb_shim: ^1.11.1+1
collection: ^1.15.0-nullsafety.4
filesystem_picker: ^4.0.0
+ device_info_plus: ^9.1.0
dependency_overrides:
intl: any
diff --git a/pubspec.lock b/pubspec.lock
index df00e5920..4069848de 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -306,6 +306,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.4.4"
+ device_info_plus:
+ dependency: "direct main"
+ description:
+ name: device_info_plus
+ sha256: "7035152271ff67b072a211152846e9f1259cf1be41e34cd3e0b5463d2d6b8419"
+ url: "https://pub.dev"
+ source: hosted
+ version: "9.1.0"
+ device_info_plus_platform_interface:
+ dependency: transitive
+ description:
+ name: device_info_plus_platform_interface
+ sha256: d3b01d5868b50ae571cd1dc6e502fc94d956b665756180f7b16ead09e836fd64
+ url: "https://pub.dev"
+ source: hosted
+ version: "7.0.0"
diacritic:
dependency: "direct main"
description:
@@ -1862,6 +1878,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "5.0.9"
+ win32_registry:
+ dependency: transitive
+ description:
+ name: win32_registry
+ sha256: "41fd8a189940d8696b1b810efb9abcf60827b6cbfab90b0c43e8439e3a39d85a"
+ url: "https://pub.dev"
+ source: hosted
+ version: "1.1.2"
window_manager:
dependency: "direct main"
description:
diff --git a/pubspec.yaml b/pubspec.yaml
index 83853793a..c1b2b489c 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -95,6 +95,7 @@ dependencies:
# idb_shim: ^1.11.1+1
collection: ^1.15.0-nullsafety.4
filesystem_picker: ^4.0.0
+ device_info_plus: ^9.1.0
dependency_overrides:
intl: any