Dart Analyze logoDart Analyze/
DRT-W1261

Type parameter has the same name as the class, mixin, or extension that declares itDRT-W1261

Major severityMajor
Bug Risk categoryBug Risk

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> {}