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>()
}
Unless stated otherwise, the documentation on this site reflects Dart 3.7.3. Page last updated on 2025-05-08. View source or report an issue.