Dart Analyze logoDart Analyze/
DRT-W1478

Missing concrete implementation of a `@mustBeOverridden` memberDRT-W1478

Major severityMajor
Bug Risk categoryBug Risk

The analyzer produces this diagnostic when an instance member that has the @mustBeOverridden annotation isn't overridden in a subclass.

Example

The following code produces this diagnostic because the class B doesn't have an override of the inherited method A.m when A.m is annotated with @mustBeOverridden:

import 'package:meta/meta.dart';

class A {
  @mustBeOverridden
  void m() {}
}

class B extends A {}

Common fixes

If the annotation is appropriate for the member, then override the member in the subclass:

import 'package:meta/meta.dart';

class A {
  @mustBeOverridden
  void m() {}
}

class B extends A {
  @override
  void m() {}
}

If the annotation isn't appropriate for the member, then remove the annotation:

class A {
  void m() {}
}

class B extends A {}