amake / flutter.el

Flutter tools for Emacs
GNU General Public License v3.0
123 stars 11 forks source link

Needs a way to choose a target device for `flutter run` #1

Closed NeedMoreDesu closed 1 year ago

NeedMoreDesu commented 5 years ago

It should be possible to obtain devices prior to run, and propose to chose one if it's not the only one.

Right now, you have to run it once to fail and obtain device ID, then run with arg, then inpur "-d device-id".

amake commented 5 years ago

It is possible with e.g. flutter devices but on my machine I find that takes nearly two seconds, so I wouldn't want to run that every time.

One thought I had was to allow setting default args, so if you usually wanted to run on all devices you could set (setq flutter-run-default-args "-d all") somewhere. What do you think of that?

The optimal solution would be to let flutter run fail and THEN prompt and retry, but that sounds complicated and I don't know when I'll have time to look into it.

GLodi commented 5 years ago

Hi! I would love this feature.

I tried to put (setq flutter-run-default-args "-d all") under user-config (I'm using spacemacs) but that didn't work. Would it be possible to have an option like flutter-run-on-all directly?

amake commented 5 years ago

(setq flutter-run-default-args "-d all") doesn't work because I didn't implement it, because I got no feedback on the idea and it's not that great a solution.

You can define flutter-run-on-all yourself:

(defun flutter-run-on-all ()
  (flutter-run "-d all"))

Edit: But you probably want flutter-run-all-or-hot-reload:

(defun flutter-run-all-or-hot-reload ()
  (interactive)
  (if (flutter--running-p)
      (flutter-hot-reload)
    (flutter-run "-d all")))
GLodi commented 5 years ago

Thank you. I should've studied a bit of elisp before asking. I've just started with emacs.

amake commented 5 years ago

Beyond just the target device, I am starting to need to specify other options too, like --flavor and --target. Once you get into all that stuff, something like transient starts to look pretty attractive.

jakoblind commented 4 years ago

I need to be able to specify--flavor. We have one flavor for each environment. Ideally, I would like to define all environments in some config file, and then run some command to list all flavors from the file and be able to select one to run.

ericdallo commented 4 years ago

lsp-dart allows you to specify devices and custom templates for debugging.

Maybe could help to implement on flutter.el

oatmealm commented 4 years ago

When running (with or without flutter-run-default-args "-d linux" for example, it prompts to chooce a device, but doesn't accept any value in my case (Doom Emacs).

amake commented 1 year ago

There is now flutter-run-device; see #28. If that doesn't adequately address this ticket, please open a new ticket with details on the use case.