reset all value of controller in flutter with getx packages?

10.6k views Asked by At

hi i want to know how te reset all value of controller in getx packages ?

I already tried

Get.reset();

but that's not working

3

There are 3 answers

0
Kalyan Biswas On

You have to use force: true:

Get.delete<BookAppointmentController>(force: true);
0
Ninad7N On

Get.deleteAll(); deletes all Instances Data Get.delete<ControllerName>(); to delete a particular controller Instance. Also, if you used GetxService then call Get.reset().

0
Nastaran Mohammadi On

Get.reset() is for removing all pages that you added them in stack navigator and it is not for resetting the values of GetXController parameters if you want to reset controller values you must define your controller after build like this: Widget build(BuildContext context) {final MessageController msController = Get.put(MessageController());