Best Practice for Using GetX Dependency Injection Without GetMaterialApp #3070
Unanswered
LeonManolo
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Initially, GetMaterialApp should only be used for routes, snackbars, and modals. If you only use dependency injection and state management, it is unnecessary. Second, if you don't use routes, auto-dispose won't happen, unless you use one of two alternatives:
GetX is flexible (sometimes too much), and you can do it however you see fit. All the 3 ways above will work perfectly, without any problems. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I am planning to conduct a performance comparison among various state management systems within Flutter, aiming to maintain a consistent app structure throughout the testing process. One of my goals is to explore the most efficient way to utilize GetX's dependency injection features without relying on
GetMaterialApp
.In the context of using Bloc, I'm familiar with wrapping the
MaterialApp
widget withBlocProvider
to ensure global access to the Bloc across the application. This approach allows for a neat integration with the Flutter framework while maintaining the ability to inject dependencies as needed.However, when it comes to GetX, I understand that
GetMaterialApp
is typically recommended for leveraging the full suite of GetX's capabilities, including routing, state management, and dependency injection. My question is: What would be the best practice for implementing GetX dependency injection in a Flutter app without usingGetMaterialApp
? I'm looking for a method that would allow me to maintain a similar level of global accessibility and ease of integration as theBlocProvider
does for Bloc, but within the constraints of using GetX for state management and dependency injection.My primary intention is to ensure that the app structure remains consistent while testing different state management systems, to achieve a fair comparison in terms of performance and usability. Any guidance or recommendations on how to best approach this with GetX would be greatly appreciated.
Thank you in advance for your assistance.
Beta Was this translation helpful? Give feedback.
All reactions