Studio中使用Flutter时更改自动缩进线设置

Studio中使用Flutter时更改自动缩进线设置

本文介绍了在Android Studio中使用Flutter时更改自动缩进线设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

自动缩进线会不正确地转移重定向构造函数的缩进.

Auto-Indent Lines improperly shifts indent of Redirecting constructors.

自动缩进的结果如下.

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

我想要的结果如下.

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

问题

  • 如何在Android Studio中更改自动缩进线设置.
    • Android Studio 3.1.4
    • 尝试:我选中了首选项"->代码样式"->飞镖"->标签和缩进"以及包装和花括号"→错误:没有合适的地方.
    • Tried : I checked "Preferences" -> "Code Style" -> "Dart" -> "Tabs and Indents" and "Wrapping and Braces"→Error : There is no applicable place.

    最诚挚的问候,

    推荐答案

    Dart(以及Flutter)使用其自己的代码格式化程序 dartfmt ,因此无法通过IDE控制缩进等.在这种情况下,dartfmt会根据可选的结尾逗号来不同地设置代码格式.

    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.

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

    使用

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

    这篇关于在Android Studio中使用Flutter时更改自动缩进线设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

    1403页,肝出来的..

09-06 21:16