must_call_super
This method overrides a method annotated as '@mustCallSuper' in '{0}', but doesn't invoke the overridden method.
Description
#The analyzer produces this diagnostic when a method that overrides a method that is annotated as mustCallSuper
doesn't invoke the overridden method as required.
Example
#The following code produces this diagnostic because the method m
in B
doesn't invoke the overridden method m
in A
:
dart
import 'package:meta/meta.dart';
class A {
@mustCallSuper
m() {}
}
class B extends A {
@override
m() {}
}
Common fixes
#Add an invocation of the overridden method in the overriding method:
dart
import 'package:meta/meta.dart';
class A {
@mustCallSuper
m() {}
}
class B extends A {
@override
m() {
super.m();
}
}
Was this page's content helpful?
Thank you for your feedback!
Provide details Thank you for your feedback! Please let us know what we can do to improve.
Provide details Unless stated otherwise, the documentation on this site reflects Dart 3.8.1. Page last updated on 2025-05-08. View source or report an issue.