I found out that dispose method of TextEditingController in LoginViewModel is not called when dispose should be called.
In BaseView class dispose is mentioned, however it was not implemented in LoginView. I tried to solve it, but I couldn't dispose, because dispose's type is VoidCallback, so it is not possible to get viewModel (LoginViewModel) in dispose method. So I changed:
final VoidCallback? onDispose;
.
.
@override void dispose() {
super.dispose();
if (widget.onDispose != null) widget.onDispose?.call();
}
to
final Function(T model)? onDispose;
.
.
.
@override
void dispose() {
if (widget.onDispose != null) widget.onDispose!(model);
super.dispose();
}
I found out that dispose method of TextEditingController in LoginViewModel is not called when dispose should be called. In BaseView class dispose is mentioned, however it was not implemented in LoginView. I tried to solve it, but I couldn't dispose, because dispose's type is VoidCallback, so it is not possible to get viewModel (LoginViewModel) in dispose method. So I changed:
to
and called dispose in this way in LoginView
I hope it is helpful. I might be completely wrong, so take it easy :)