difference between Reformat Code / Reformat Code with dartfmt

4,071

Solution 1

Difference between them I don't know but I know how you can add a shortcut to format code: Go to

File -> Settings -> Keymap -> Editor Action -> Reformate Code with dartfmt

and add click on it and add a shortcut

Solution 2

Both are the same essentially.

The only difference is that Reformat Code (ctrl + alt + L) applies only to the file open in the Editor or the file selected in project files pane using Intellij's Code formatter feature.

While Reformat Code using dartfmt uses dartfmt CLI command available with the flutter SDK.

The output of both will be the same. dartfmt allow you to format the code on directory level and from a cmd/terminal instead of an IDE.

Share:
4,071
Admin
Author by

Admin

Updated on December 16, 2022

Comments

  • Admin
    Admin over 1 year

    In Android studio, when I open a dart file, I see two options to format the code, so my question is

    What is the difference between Reformat Code / Reformat Code with dartfmt

    enter image description here

  • Admin
    Admin over 4 years
    is there output same/identical?
  • Chris
    Chris almost 3 years
    This does not answer the OP's question.