unqualified_reference_to_non_local_static_member
Static members from supertypes must be qualified by the name of the defining type.
Description
#The analyzer produces this diagnostic when code in one class references a static member in a superclass without prefixing the member's name with the name of the superclass. Static members can only be referenced without a prefix in the class in which they're declared.
Example
#The following code produces this diagnostic because the static field x
is referenced in the getter g
without prefixing it with the name of the defining class:
class A {
static int x = 3;
}
class B extends A {
int get g => x;
}
Common fixes
#Prefix the name of the static member with the name of the declaring class:
class A {
static int x = 3;
}
class B extends A {
int get g => A.x;
}
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.