Flutter Dart: Prefer const with constant constructors (prefer_const_constructors)

Опубликовано: 25 Март 2026
на канале: Julia pak TorontoTrashPanda
5,601
183

Are you getting the following errors in VSCode?
1. Prefer const with constant constructors.dart. (prefer_const_constructors)
2. Prefer const literals as parameters of constructors on @immutable classes.dart. (prefer_const_literals_to_create_immutables)


This is a linter issue! The flutter team created a new package called flutter_lints and it is added to your analysis_options.yaml by default. Here is how to edit that analysis_options.yaml file to ignore these!
rules:
prefer_const_constructors: false
prefer_const_literals_to_create_immutables: false
prefer_const_constructors_in_immutables: false