Search code examples
flutterdartandroid-studio

How to replace dart formatter?


I'm using android studio and flutter plugin. It is using dart formatter. I don't want it.

In settings there is :

Code is formatted using the dart format tool included with the Dart SDK. See FAQ.

and nothing more.

How to replace it with something other?


Solution

  • I believe there isn't any way to replace the formatter for Dart in Android Studio, only by using the settings of the Dart and Flutter plugins. The best you can do with the settings provided by the plugins is to disable formatting on save via Settings -> Languages & Frameworks -> Flutter -> Uncheck Format code on save.

    You could create a custom external tool (see https://www.jetbrains.com/help/idea/settings-tools-external-tools.html) to run a script via a shortcut in the IDE. Write your custom formatting logic in that script and run it using the shortcut. I believe this is the closest you can get to what you want to achieve.