Flutter: How to get app path from within the app after it's built

295 Views Asked by At

I have a project named foo. I built the bundle by flutter build linux and the binary is available in /build/linux/x64/release/bundle/foo Lets say I moved this bundle folder to ~/Downloads and then execute foo I should be able to display the path of the binary /home/user/Downloads/bundle/foo. If I rename foo to bar manually and execute bar, I should be able to display /home/user/Downloads/bundle/bar

Directory.current will give the parent directory (/home/user/Downloads/bundle/), but I need the name of the binary too (foo). Is this possible?

0

There are 0 best solutions below