I would like to use 2 controllers inside each other, but the problem is that one of them has to be initialized before the other one. For example
class FirstController extends GetxController {
SecondController _secondController = Get.find<SecondController>();
}
class SecondController extends GetxController {
FirstController _firstController = Get.find<FirstController>();
}
I used both put and lazyPut but nothing worked for me. Is there any way to do so?
So I managed to solve this problem by removing the declaration of the second controller in the first controller, and used this inside a method.
void myMethod()
{
Get.find<SecondController>().methodName();
}