conflicting_type_variable_and_container
'{0}' can't be used to name both a type parameter and the class in which the type parameter is defined.
'{0}' can't be used to name both a type parameter and the enum in which the type parameter is defined.
'{0}' can't be used to name both a type parameter and the extension in which the type parameter is defined.
'{0}' can't be used to name both a type parameter and the extension type in which the type parameter is defined.
'{0}' can't be used to name both a type parameter and the mixin in which the type parameter is defined.
Description
#The analyzer produces this diagnostic when a class, mixin, or extension declaration declares a type parameter with the same name as the class, mixin, or extension that declares it.
Example
#The following code produces this diagnostic because the type parameter C
has the same name as the class C
of which it's a part:
class C<C> {}
Common fixes
#Rename either the type parameter, or the class, mixin, or extension:
class C<T> {}
除非另有说明,文档之所提及适用于 Dart 3.7.3 版本,本页面最后更新时间: 2025-05-08。 查看文档源码 或者 报告页面问题。