Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More Flutter commands #10

Open
Davoodeh opened this issue Mar 16, 2020 · 4 comments
Open

More Flutter commands #10

Davoodeh opened this issue Mar 16, 2020 · 4 comments

Comments

@Davoodeh
Copy link

Davoodeh commented Mar 16, 2020

Hi, thanks for the incredible job here!
Been using the package for a couple of days now. Just saw the package lacking some essential commands (in order to keep us in the Emacs only xD) (and since I'm a noob in writin Lisp thought I just come here and say what I think instead of making a Pull request).

Just the absence of a functions like: flutter-create is a big deal. (and pub)
It would be nice to implement such commands in here too.

@amake
Copy link
Owner

amake commented Mar 17, 2020

Thanks for the kind words.

I don't see flutter create as a priority because it's a one-time event in the lifecycle of a project, and could add significant maintenance burden (following upstream changes to the interface).

PRs are always welcome, though.

@Davoodeh
Copy link
Author

Thanks a lot!
I leave this open in case somebody gets inspired to write it (or myself if I ever learn enough xD)

@zhaozhixu
Copy link

What about flutter pub run build_runner build, which is quite common in generate JSON serialization code etc?

Or perhaps better, provide some hook point so we can customize commands for running before flutter run (perhaps using project root as working directory)?

Thanks for the awesome package!

@zhaozhixu
Copy link

What about flutter pub run build_runner build, which is quite common in generate JSON serialization code etc?

Or perhaps better, provide some hook point so we can customize commands for running before flutter run (perhaps using project root as working directory)?

Thanks for the awesome package!

For those who have the same needs, my flutter package config is:

(defun my-flutter-build-run-watch ()
  "Run `flutter pub run build_runner watch`."
  (interactive)
  (flutter--from-project-root
   (let* ((buffer-name "*Flutter-build-runner-watch*")
          (buffer (flutter--get-buffer-create buffer-name))
          (alive (comint-check-proc buffer-name)))
     (unless alive
       (progn (apply #'make-comint-in-buffer "Flutter-build-runner-watch" buffer (flutter-build-command) nil '("pub" "run" "build_runner" "watch"))
              (display-buffer buffer))))))

(defun my-flutter-run-or-hot-reload ()
  "Run 'flutter run' or perform a hot reload, and open the *Flutter* buffer."
  (interactive)
  (my-flutter-build-run-watch)
  (flutter-run-or-hot-reload)
  (switch-to-buffer-other-window "*Flutter*"))

This opens a process buffer calling flutter pub run build_runner watch in the first time flutter runs, and stays background watching file changes and generating code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants