0

I'm trying to implement a permission handler to access the files. this is where I stopped after checking multiple resources online and the package page file picker. the issue is when I press the button I get this popup without asking to allowing the permission. I checked the settings yet nothing is permanently denied and if it was. shouldn't it ask me for the 1st time to enable it? app screen shot

here is a look on my permissions used

>   <uses-permission android:name="android.permission.CAMERA"/>
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
   <uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/>
   <uses-permission android:name="android.permission.READ_MEDIA_VIDEO"/>
  <uses-permission android:name="android.permission.READ_MEDIA_AUDIO"/>
  <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>



Future<void> openFileExp() async {
final PermissionStatus status = await 
Permission.storage.request();
if (status.isDenied) {
  showAlertDialog(context);
} else if (status.isPermanentlyDenied) {
  openAppSettings();
} else if (status.isGranted) {
  try {

      result = await FilePicker.platform
          .pickFiles(allowMultiple: true);
    
  } catch (e) {
    // Handle any errors that occur during image picking
    print('Error picking image: $e');
    showAlertDialog(context);
    }
  }
}

calling the function here

IconButton(
                              onPressed: () async {
                                print("attachment file button");
                                openFileExp();
                                //Navigator.of(context).push(MaterialPageRoute(builder: (context) => const FilePickerScreen(title: 'pick a file',)));;
                                // showModalBottomSheet(
                                //     backgroundColor: Color(s),
                                //     context: context, builder: (builder)=>bottomSheet())
                              },
                              icon: const Icon(Icons.attach_file)),

0