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

Add flutter-args variable #29

Merged
merged 3 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,17 @@ put the Flutter SDK in `/Applications/flutter`:
(flutter-sdk-path "/Applications/flutter/"))
```

## .dir-locals.el

`flutter-args` is used to set default CLI flags passed to `flutter`.
This variable can be set per project using a `.dir-locals.el` file in project root.
The following `.dir-locals.el` sets `flutter-args` to build linux executable and
enables hot reloading on file save using `after-save-hook`.

``` elisp
((dart-mode . ((flutter-args . "-d linux")
(eval . (add-hook 'after-save-hook 'flutter-run-or-hot-reload nil t)))))
```

# License
GPL-3
7 changes: 6 additions & 1 deletion flutter.el
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
(defvar flutter-sdk-path nil
"Path to Flutter SDK.")

(defvar flutter-args nil
"Space-delimited string of CLI flags passed to `flutter`.")


;;; Key bindings

Expand Down Expand Up @@ -259,7 +262,9 @@ args."
(list (when current-prefix-arg
(read-string "Args: "))))
(flutter--with-run-proc
args
(if args
args
flutter-args)
(display-buffer buffer)))

(defun flutter--devices ()
Expand Down