equal_elements_in_const_set
Two elements in a constant set literal can't be equal.
Description
#The analyzer produces this diagnostic when two elements in a constant set literal have the same value. The set can only contain each value once, which means that one of the values is unnecessary.
Example
#The following code produces this diagnostic because the string 'a'
is
specified twice:
dart
const Set<String> set = {'a', 'a'};
Common fixes
#Remove one of the duplicate values:
dart
const Set<String> set = {'a'};
除非另有说明,文档之所提及适用于 Dart 3.7.3 版本,本页面最后更新时间: 2025-05-08。 查看文档源码 或者 报告页面问题。