Pular para o conteúdo principal

conflicting_type_variable_and_container

Detalhes sobre o diagnóstico 'conflicting_type_variable_and_container' produzido pelo analisador do Dart.

'{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.

Descrição

#

O analisador emite este diagnóstico quando uma declaração de classe, mixin ou extensão declara um parâmetro de tipo com o mesmo nome da classe, mixin ou extensão que o declara.

Exemplo

#

O código a seguir produz este diagnóstico porque o parâmetro de tipo C tem o mesmo nome da classe C da qual ele faz parte:

dart
class C<C> {}

Correções comuns

#

Renomeie o parâmetro de tipo, ou a classe, mixin ou extensão:

dart
class C<T> {}

Encontrou essa página sem tradução ou que precisa de correção? Abra uma issue e nos ajude a manter esse site em PT-BR para ajudar pessoas como você.