unqualified_ reference_ to_ static_ member_ of_ extended_ type
Static members from the extended type or one of its superclasses must be qualified by the name of the defining type.
Description
#The analyzer produces this diagnostic when an undefined name is found, and the name is the same as a static member of the extended type or one of its superclasses.
Example
#
The following code produces this diagnostic because m is a static member
of the extended type C:
class C {
static void m() {}
}
extension E on C {
void f() {
m();
}
}
Common fixes
#If you're trying to reference a static member that's declared outside the extension, then add the name of the class or extension before the reference to the member:
class C {
static void m() {}
}
extension E on C {
void f() {
C.m();
}
}
If you're referencing a member that isn't declared yet, add a declaration:
class C {
static void m() {}
}
extension E on C {
void f() {
m();
}
void m() {}
}
Unless stated otherwise, the documentation on this site reflects Dart 3.10.3. Page last updated on 2025-9-4. View source or report an issue.