expected_ one_ set_ type_ arguments
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:
var s = <int, String, int>{0, 'a', 1};
Common fixes
#Remove all except one of the type arguments:
var s = <int>{0, 1};
Unless stated otherwise, the documentation on this site reflects Dart 3.9.2. Page last updated on 2025-9-1. View source or report an issue.