vscode 中的 Dart 格式很奇怪

Dart format is weird in vscode

我的 dart 文件格式很奇怪

    return Scaffold(
        backgroundColor: bgColor,
        body: SafeArea(
            child: Container(
          decoration: BoxDecoration(
              image: DecorationImage(
                  image: AssetImage('assets/$bgImage'), fit: BoxFit.cover)),
          child: Padding(
            padding: const EdgeInsets.fromLTRB(0, 120, 0, 0),
            child: Column(
              children: <Widget>[
                FlatButton.icon(

如何进行设置,以便正常的小部件树可以正确缩进。

此外,我设置了“editor.rulers”:[120],这仍然给我不想要的自动缩进:

                    onPressed: () async {
                      **dynamic result =
                          await Navigator.pushNamed(context, '/location');**
                      setState(() {
                        data = {
                          'time': result['time'],
                          'location': result['location'],
                          'flag': result['flag'],
                          'isDaytime': result['isDaytime']
                        };
                      });
                    },

在参数列表中使用尾随逗号。

没有尾随逗号:

Foo(arg1: ..., arg2: ...)

尾随逗号:

Foo(
  arg1: ...,
  arg2: ..., // notice the comma
)

例如:

decoration: BoxDecoration(
  image: DecorationImage(
    image: AssetImage('assets/$bgImage'), 
    fit: BoxFit.cover, // add a comma here
  ), // add a comma here
),