How to dispose FocusNode and TextEditingController inside a Dialog in Flutter
- Create a separate class and make it
StatefulWidget
; - in the State class use
dispose()
to dispose your controllers.
Note: avoid having complex code inside of an anonymous functions.