proper-super-calls
preset: recommended
Checks that super
calls in the initState
and dispose
methods are called in the correct order.
Example
❌ Bad:
class _MyHomePageState<T> extends State<MyHomePage> {
int _counter = 0;
void initState() {
someWork();
super.initState(); // LINT
}
void dispose() {
super.dispose(); // LINT
someWork();
}
}
✅ Good:
class _MyHomePageState<T> extends State<MyHomePage> {
int _counter = 0;
void initState() {
super.initState();
someWork();
}
void dispose() {
someWork();
super.dispose();
}
}