I'm using the package android_intent and never work in Android native, but searching in official documentation, I create this code based in Kotlin codes.
String uriFile =
Uri.encodeFull("content://${contentFile.path}");
if (Platform.isAndroid) {
final AndroidIntent intent = AndroidIntent(
action: "action_view",
data: uriFile,
type: "application/pdf",
// type: "multipart/",
flags: [
Flag.FLAG_GRANT_READ_URI_PERMISSION,
Flag.FLAG_GRANT_PERSISTABLE_URI_PERMISSION,
Flag.FLAG_ACTIVITY_NEW_TASK
],
);
intent.launch();
This example generate this log:
V/IntentSender(25283): Sending intent Intent { act=android.intent.action.VIEW dat=content:///data/user/0/br.com.encaixaonline/app_flutter/encaixa-online/arquivos/boleto_facil_exemplo.pdf typ=application/pdf flg=0x10000041 (has extras) }
It generates the alert and displays the applications that allow you to open the PDF, but it does not display the file in any of the applications.