'Why is Flutter open_file not opening files on android device?

I'm working on a mobile Flutter app. I need to show some files in the app, but on iOS the files are opening correctly and on Android it won't. Does anyone know what's the problem?

here is my code:

if (await File("$dir/" + documentName).exists()) {
    
        // if true then open file
        OpenFile.open("$dir/" + documentName).whenComplete(() => Navigator.pushReplacement(
          context,
          PageRouteBuilder(
            pageBuilder: (context, animation1, animation2) => documents_page(),
            transitionDuration: const Duration(seconds: 0),
          ),
        ));
      }

I don't get any errors as well..



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source