diff --git a/lib/src/form/src/controller.dart b/lib/src/form/src/controller.dart index 0d93501..61d3583 100644 --- a/lib/src/form/src/controller.dart +++ b/lib/src/form/src/controller.dart @@ -111,6 +111,17 @@ class AstromicFormController extends FormController { return ret; } + @override + void removeController(String id) { + super.removeController(id); + if (fieldStates.containsKey(id)) { + fieldStates.remove(id); + } + if (fieldMessages.containsKey(id)) { + fieldMessages.remove(id); + } + } + //SECTION - Helper Methods void _addInitialControllers(Map? initialValues) { if (initialValues != null) { diff --git a/pubspec.lock b/pubspec.lock index 10642cc..aeb1509 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -165,7 +165,7 @@ packages: description: path: "." ref: master - resolved-ref: "3abe6f1eb41244f33973b4c7f5b40200edc08ccf" + resolved-ref: ef28b08380a54747c58c585e4326e30bcc468a51 url: "https://git.micazi.dev/micazi/form_controller.git" source: git version: "0.8.8+2"