Flutter execute binary
Asked Answered
S

1

10

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

Superphosphate answered 20/4, 2019 at 14:41 Comment(2)
Did you ever find out how to do this?Ronnieronny
Any progress in here?Bitstock
B
1

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.

Briefs answered 20/12, 2021 at 0:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.