flutter.el icon indicating copy to clipboard operation
flutter.el copied to clipboard

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

Open NeedMoreDesu opened this issue 6 years ago • 8 comments

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".

NeedMoreDesu avatar Feb 04 '19 11:02 NeedMoreDesu

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.

amake avatar Feb 06 '19 00:02 amake

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?

GLodi avatar May 08 '19 15:05 GLodi

(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")))

amake avatar May 08 '19 23:05 amake

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

GLodi avatar May 09 '19 08:05 GLodi

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.

amake avatar Jul 19 '19 07:07 amake

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.

jakoblind avatar Apr 27 '20 07:04 jakoblind

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

Maybe could help to implement on flutter.el

ericdallo avatar May 15 '20 21:05 ericdallo

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).

oatmealm avatar Aug 03 '20 12:08 oatmealm

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.

amake avatar Aug 11 '23 05:08 amake