flutter-permission-handler
                                
                                 flutter-permission-handler copied to clipboard
                                
                                    flutter-permission-handler copied to clipboard
                            
                            
                            
                        [Feature request]: Hide platform version details for Permission.photos
Is there already an issue requesting this feature?
- [X] I have searched the existing issues.
Please select affected platform(s)
- [X] Android
- [X] iOS
- [X] Windows
Use case
When using permission_handler to check for photos permission you must check the platform and the Android version like so:
if (Platform.isAndroid) {
  final androidInfo = await DeviceInfoPlugin().androidInfo;
  if (androidInfo.version.sdkInt <= 32) {
    /// use [Permission.storage]
  }  else {
    /// use [Permission.photos]
  }
}
This is explained in the documentation for Permission.photos here. This runs against the design goal of Flutter plugins to hide platform-specific details whenever possible.
Proposal
I propose that Permission.photos should be changed to do the platform and Android version checks itself so that it behaves as expected on lower Android versions.
This would be a breaking change, but it would serve to fix this issue and seems worth it since most users of this plugin are in the future.
Specific requirements or considerations
No response
Additional information or context
No response
FYI in the meantime we are considering adding an extension something like this:
extension PermissionExtension on Permission {
  static Future<Permission> get photosOrStorage async {
    final androidInfo = await DeviceInfoPlugin().androidInfo;
    final isAndroidTPlus = (androidInfo.version.sdkInt ?? 0) >= 33;
    if (isAndroidTPlus) {
      return Permission.photos;
    } else {
      return Permission.storage;
    }
  }
}
But it would be better to come from permission_handler itself, IMO. The cross-plugin dependency on device_info_plus is not ideal here.
Dear @ChristianEdwardPadilla,
Thanks for submitting this feature. We discussed this feature request in the team and we decided to label this issue as an enhancement. We are working on a refactor of the permission handler. During the refactor we well be handling this feature request.
Kind regards,