private_collision_in_mixin_application
The private name '{0}', defined by '{1}', conflicts with the same name defined by '{2}'.
Description
#The analyzer produces this diagnostic when two mixins that define the same private member are used together in a single class in a library other than the one that defines the mixins.
Example
#Given a file a.dart
containing the following code:
mixin A {
void _foo() {}
}
mixin B {
void _foo() {}
}
The following code produces this diagnostic because the mixins A
and B
both define the method _foo
:
import 'a.dart';
class C extends Object with A, B {}
Common fixes
#If you don't need both of the mixins, then remove one of them from the with
clause:
import 'a.dart';
class C extends Object with A, B {}
If you need both of the mixins, then rename the conflicting member in one of the two mixins.
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.