conflicting_
                  '{0}' can't be used to name both a constructor and a static field in this class.
'{0}' can't be used to name both a constructor and a static getter in this class.
'{0}' can't be used to name both a constructor and a static method in this class.
'{0}' can't be used to name both a constructor and a static setter in this class.
Description
#The analyzer produces this diagnostic when a named constructor and either a static method or static field have the same name. Both are accessed using the name of the class, so having the same name makes the reference ambiguous.
Examples
#
                    The following code produces this diagnostic because the static field foo
                    and the named constructor foo have the same name:
                  
class C {
  C.foo();
  static int foo = 0;
}
                    The following code produces this diagnostic because the static method foo
                    and the named constructor foo have the same name:
                  
class C {
  C.foo();
  static void foo() {}
}
Common fixes
#Rename either the member or the constructor.
Unless stated otherwise, the documentation on this site reflects Dart 3.9.2. Page last updated on 2025-9-4. View source or report an issue.