How to execute binary file in flutter? I have put the binary into assets and added to my code function to 'unpack' it (How do I get the Asset's file path in flutter?).
The file is in the app data folder:
generic_x86:/data/data/com.example.hidden/app_flutter # ls
binaryfile flutter_assets
generic_x86:/data/data/com.example.hidden/app_flutter #
However when I try executing it using the Process.run
it says Permission denied
. When I chmod +x
or chmod 777
it using root shell, it says No such file or directory
. However I would prefer some no root method to do this.
How can I properly execute prebuilt binaries in Flutter? Thanks
I think the way to do this is to copy your binary file from assets to a local directory, as obtained by final directory = await getApplicationDocumentsDirectory()
, and to then call Process.run
with that file as the command argument.
Even then, I don't believe you can run anything as root
this way, and your access to the file system may be quite limited.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With