admin 管理员组文章数量: 1086019
Previously, VS Code would automatically show the warning:
Try adding the 'const' keyword to the constructor invocation
However, now it only appears if I explicitly add
prefer_const_constructors: true
in my analysis_options.yaml
.
I want VS Code to show this warning automatically without needing to enable the rule manually in every project.
Flutter Version : 3.29.0
Dart Version : 3.7.0
Previously, VS Code would automatically show the warning:
Try adding the 'const' keyword to the constructor invocation
However, now it only appears if I explicitly add
prefer_const_constructors: true
in my analysis_options.yaml
.
I want VS Code to show this warning automatically without needing to enable the rule manually in every project.
Flutter Version : 3.29.0
Dart Version : 3.7.0
Share
Improve this question
edited Mar 28 at 10:17
Munsif Ali
6,4525 gold badges25 silver badges53 bronze badges
asked Mar 28 at 7:13
Akhil GeeAkhil Gee
4472 silver badges16 bronze badges
0
2 Answers
Reset to default 1The const lint has been removed from flutter lints. You could check this issue https://github/dart-lang/core/issues/833 and https://github/flutter/flutter/issues/149932 or more details.
Right now, you would need to enable this lint rule in your `analysis_options.yaml` if you need it.
That has been removed by default check this issue https://github/dart-lang/core/issues/833 along with other lints like avoid_print
which was enabled in flutter lints by default.
The following lints were removed in flutter_lints: 5.0.0
prefer_const_constructors
prefer_const_literals_to_create_immutables
prefer_const_declarations
in this PR https://github/flutter/flutter/pull/156011
if you want to enable that again add this in analysis_options.yaml
linter:
rules:
prefer_const_constructors: true
or you can use version lesser than 5.0.0
like flutter_lints: ^4.0.0
本文标签: lintFlutter VS Code Not Showing 39const39 Warning AutomaticallyStack Overflow
版权声明:本文标题:lint - Flutter VS Code Not Showing 'const' Warning Automatically - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://roclinux.cn/p/1744051417a2525088.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论