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 best solutions below

0
On

You have to use force: true:

Get.delete<BookAppointmentController>(force: true);
0
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
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());