expected_one_set_type_arguments
Details about the 'expected_one_set_type_arguments' diagnostic produced by the Dart analyzer.
Set literals require one type argument or none, but {0} were found.
Description
#The analyzer produces this diagnostic when a set literal has more than one type argument.
Example
#The following code produces this diagnostic because the set literal has three type arguments when it can have at most one:
dart
var s = <int, String, int>{0, 'a', 1};
Common fixes
#Remove all except one of the type arguments:
dart
var s = <int>{0, 1};
Was this page's content helpful?
除非另有说明,文档之所提及适用于 Dart 3.10.3 版本报告页面问题.