What is the difference between the two code blocks?
First code block
TextEditingController textEditingController = TextEditingController();
@override
void dispose() {
super.dispose();
textEditingController.dispose();
}
second code block
TextEditingController textEditingController = TextEditingController();
@override
void dispose() {
textEditingController.dispose();
super.dispose();
}
CodePudding user response:
super.dispose()
should always be the last line in the overrided dispose function, because you should deactivate your specific widget before deactivating the super class widgets.
https://api.flutter.dev/flutter/widgets/State/dispose.html