How to dispose FocusNode and TextEditingController inside a Dialog in Flutter

  1. Create a separate class and make it StatefulWidget;
  2. in the State class use dispose() to dispose your controllers.

Note: avoid having complex code inside of an anonymous functions.