Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter desktop windows get application path

Tags:

flutter

dart

I am creating a Flutter Desktop application for windows and I am trying to retrieve the application directory where the exe is located. I tried to use path_provider but can only get the Documents directory. Any help I would appreciate lots.

like image 994
Daniel Melo Avatar asked Feb 19 '26 04:02

Daniel Melo


1 Answers

Use Platform.resolvedExecutable (of dart:io).

I have tested it in Flutter/Windows and it works. Strangely, Platform.executable returns null instead. I tell strangely because its type is String not nullable. This unexpected null value can cause crash or errors that are difficult to detect (but in the end Flutter desktop is not in the stable channel).

like image 134
Mabsten Avatar answered Feb 21 '26 17:02

Mabsten



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!