I am building a Flutter app and need to implement functionality to download a PDF file and save it to the Downloads folder on iOS devices. Additionally, I want the file to appear in the Recents section of the Files app.
You should first download the file into the application folder using https://pub.dev/packages/path_provider.
String dir = (await getApplicationDocumentsDirectory()).path;
File file = File("$dir/$fileName.$fileExtension");
Then, let users choose a folder to copy the file to using https://pub.dev/packages/flutter_file_dialog, which provides a dialog for saving files.
final params = SaveFileDialogParams(sourceFilePath: file.path);
final savedPath = await FlutterFileDialog.saveFile(params: params);