Skip to content
Brady Trainor edited this page Dec 24, 2018 · 10 revisions

Finding dartfmt

Formatting is done by calling out to the dartfmt executable. You will want to make sure that dart or flutter are on your system PATH.

If you’re not able to do that, you can also set the path in your init, with, dart-sdk-path or dart-formatter-command-override.

Ensuring diff is available on Windows

Especially on Windows, you may have to add diff to your system and PATH.

One way to do this is install from http://gnuwin32.sourceforge.net/packages/diffutils.htm and add something like the following to your init file.

(setq exec-path (append exec-path '("C:/Program Files (x86)/GnuWin32/bin")))`

You may find this all easier via chocolatey, which is anyways apparently a recommended method to install dart on Windows.

Using dart-formatter

To format your dart file, you can call the command dart-formatter via the keybinding, C-c C-o. We recommend you use the following setting for convenience, so that your code is formatted on each save.

(setq dart-format-on-save t)