I have a Flutter app that downloads an Excel (.xlsx) file and opens it on iOS using the open_filex package’s OpenFilex.open() method. The Excel file opens correctly on top of my app. However, when I tap the Done button inside the Excel app to close the file, after a few seconds iOS automatically switches to the Files app showing the folder containing that file.
This interrupts my app’s user experience by taking the user away unexpectedly.
Here is a simplified version of my file download and open code using the open_filex package:
Future downloadXlsxFileForIOS({required FileData filedata}) async {
Uint8List bytes = base64.decode(filedata.fileBufferData);
final fileName = filedata.fileName.endsWith('.xlsx')
? filedata.fileName
: '${filedata.fileName}.xlsx';
final documentsDir = await FileDownloadManager.instance.getDownloadFilePath();
final filePath="${documentsDir?.path ?? "'}/$fileName';
final file = File(filePath);
await file.writeAsBytes(bytes);
await OpenFilex.open(filePath);
}
Why does iOS open the Files app automatically after closing the Excel viewer opened via open_filex from my app?
Is there any way to stop or prevent this redirect to the Files app when using open_filex or similar on iOS?
Are there recommended approaches for handling Excel files in iOS Flutter apps without triggering this Files app behavior?