Can I retrieve the last created controller? #1633
Unanswered
Darksoulsong
asked this question in
Q&A
Replies: 1 comment
-
What an interesting question, did not have the requirement to ask me this. As you mention, surely GetX know all available controllers. Alternatively, until someone answers correctly this question, you can store the controller identifiers in a list using get_storage when you init the controller in order to register them. Hope someone answers how to get an entry list of controllers in order of creation. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
So, I have this use case where I need to access the last added instance of a GetX controller from a Singleton class.
I know I can get a controller using
Get.find<SomeController>();
, but, in this step, I don't know which controller is active. But GetX surely does. How can I retrieve it?I tried to call it without parameters, but got the error
Unhandled Exception: "dynamic" not found. You need to call "Get.put(dynamic())" or "Get.lazyPut(()=>dynamic())"
.Beta Was this translation helpful? Give feedback.
All reactions