wrong_number_of_type_arguments_enum
The enum is declared with {0} type parameters, but {1} type arguments were given.
Description
#The analyzer produces this diagnostic when an enum value in an enum that has type parameters is instantiated and type arguments are provided, but the number of type arguments isn't the same as the number of type parameters.
Example
#The following code produces this diagnostic because the enum value c
provides one type argument even though the enum E
is declared to have
two type parameters:
enum E<T, U> {
c<int>()
}
Common fixes
#If the number of type parameters is correct, then change the number of type arguments to match the number of type parameters:
enum E<T, U> {
c<int, String>()
}
If the number of type arguments is correct, then change the number of type parameters to match the number of type arguments:
enum E<T> {
c<int>()
}
除非另有说明,文档之所提及适用于 Dart 3.7.3 版本,本页面最后更新时间: 2025-05-08。 查看文档源码 或者 报告页面问题。