Skip to main content

proper_super_calls

Ensures that super calls are made in the correct order for the following StatefulWidget methods:

  • initState
  • dispose

Example

BAD:


void initState() {
print('');
super.initState(); // LINT, super.initState should be called first.
}


void dispose() {
super.dispose(); // LINT, super.dispose should be called last.
print('');
}

GOOD:


void initState() {
super.initState(); // OK
print('');
}


void dispose() {
print('');
super.dispose(); // OK
}