For a simple Email login with OTP code I have a structure as follows.
- View
await _signUpCntrl.signUp(email, password);
- Controller
_showOtpDialog(email);
- _showOtpDialog func
return Get.dialog( AlertDialog(
So the thing is _showOtpDialog function is inside a controller file. ie. /Controllers/controller_file.dart
I want do something like a blocListener, call the _showOtpDialog from a screen(view) file on signup success. (also relocate the _showOtpDialog to a view file)
Using GetX I have to use one of the builders either obs or getbuilder. Which is I think not a good approach to show a dialog box.
On internet it says Workers are the alternative to BlocListener. However Workers function resides on Controller file and with that the dialog is still being called on the controller file.
As OTP dialog will have its own state and a controller I wanted to put it inside a /view/viewfile.dart How do I obtain this? I tried using StateMixin but when I call Get.dialog() it throw an error.
visitChildElements() called during build