如何在 Dart 中禁用集合文字的要求类型?

问题描述

我目前正在使用 pedantic 包进行 dart/Flutter linting。

我的analysis_options.yaml看起来像

include: package:pedantic/analysis_options.yaml

linter:
  rules:
    always_specify_types: true
    omit_local_variable_types: false

我喜欢在声明可变行时必须指定类型。但是有了这个,我还必须在创建的列表/地图上指定类型。

我遇到的问题是**内的部分

const int number = 5;
const bool isTrue = false;
const String myName = 'Dan';
const List<int> numbers = **<int>**[1,2,3,4];
const Map<String,int> ages = **<String,int>**{'Dan': 1};

这是多余的。如何设置我的 analysis_options.yaml 来解决这个问题。

谢谢!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)