Dart Analyze logoDart Analyze/
DRT-W1349

An extension override can't be used to access a static member from an extensionDRT-W1349

Major severityMajor
Bug Risk categoryBug Risk

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();
}