Change the Auto-Indent Lines setting when using Flutter in Android Studio

↘锁芯ラ 提交于 2019-12-23 21:50:09

问题


Problem

Auto-Indent Lines improperly shifts indent of Redirecting constructors.

The result of Auto-Indent is below.

 Project.getInbox()
    : this.update(
    foo: 1,
    bar: 2,
    baz: 3);

The result I want is below.

 Project.getInbox()
     : this.update(
           foo: 1,
           bar: 2,
           baz: 3);

Question

  • How can I change the Auto-Indent Lines setting in Android Studio.

Development Environment

  • Android Studio 3.1.4

Tried → Error

  • Tried : I checked "Preferences" -> "Code Style" -> "Dart" -> "Tabs and Indents" and "Wrapping and Braces" →Error : There is no applicable place.

Best regards,


回答1:


Dart (and therefore Flutter) uses its own code formatter dartfmt, so it's not possible to control indentation etc through the IDE. In this case, dartfmt will format the code differently depending on the optional trailing comma.

Without

  Project.getInbox() : this.update(foo: 1, bar: 2, baz: 3);

With

  Project.getInbox()
      : this.update(
          foo: 1,
          bar: 2,
          baz: 3,
        );


来源:https://stackoverflow.com/questions/51904550/change-the-auto-indent-lines-setting-when-using-flutter-in-android-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!