So, I'm thinking of creating a CLI application that could also be used with UI, developed in Flutter. The idea is that there would be 3 different packages, one for the business logic, one for the CLI and one for the Flutter app. Is there a way to import the Flutter app as a dependency in my CLI package, so I could open the Flutter app from the CLI? If so, how would I do it?
Asked
Active
Viewed 396 times
1 Answers
0
Seems like you want to use 1 library containing the business logic for 2 different applications: Desktop CLI app and mobile app (android/iOS).
It's very much possible with flutter. By default flutter installs only the android and iOS platform supports but by changing few configurations in installed flutter SDK we can extend the same setup to Web and Desktop apps (Windows, MacOS or linux) as well.
Check this official doc for enabling desktop support
Check this official doc for enabling Web support
You can enable these settings in your existing application only.

Sisir
- 4,584
- 4
- 26
- 37
-
Actually, what I want is to be able to open the Flutter app (in this case a desktop app) from the CLI, something like using `git gui` from the terminal – GusHill Jul 29 '21 at 13:15
-
Once you have the GUI app developed in dart and flutter, you can use simple simple shell scripts or batch scripts to launch the app? Why do you need the launcher app also to be in flutter? – Sisir Jul 29 '21 at 13:53
-
That was my doubt, if I would develop the app, build and then run it using shell or batch scripts from the CLI, or if I could run it using the `runApp` method from inside the code – GusHill Jul 29 '21 at 15:40
-
i would keep then indepenent of each other. Just create a desktop app with GUI. Then you can double to launch it or can launch it from cmd or terminal or even can launch it programatically using some OS APIs (if you have a strong requirement) – Sisir Jul 29 '21 at 15:49