extension_override_access_to_static_member
An extension override can't be used to access a static member from an extension.
Description
#The analyzer produces this diagnostic when an extension override is the receiver of the invocation of a static member. Similar to static members in classes, the static members of an extension should be accessed using the name of the extension, not an extension override.
Example
#The following code produces this diagnostic because m
is static:
extension E on String {
static void m() {}
}
void f() {
E('').m();
}
Common fixes
#Replace the extension override with the name of the extension:
extension E on String {
static void m() {}
}
void f() {
E.m();
}
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.