is easy to learn • Getx has very short syntax • With getx we don't need stateful widget • Not only state management getx also comes with navigation, Internationalization, theming support and Api call support • It's a mini framework inside a framework
for Flutter. It combines high-performance state management, intelligent dependency injection, and route management quickly and practically. • Most Liked Package Data Types • RxInt, RxString, RxBool, RxDouble, RxMap, RxList and RxSet • Nullable types -: RxnInt, RxnBool etc.
It extends DisposableInterface. • GetxController comes with onInit() and onClose() methods which essentially replace the initState() and dispose() methods of the StatefulWidget. • GetxController also comes with onReady() which is called after the widget is rendered on screen OnInit() OnReady() OnClose()
dependency available to all the child routes. • Get.find() -: So, in case we need to access the same instance in some other class, we can do that using Get.find. • Get.create() -: This one creates a new instance of the dependency every time Get.find is called. • Get.lazyPut() -: it lazy loads the dependencies, which basically means that the dependencies will be created immediately but will be loaded to memory only when Get.find is called for the first time. • Get.asyncPut() -: When using SharedPreferences or async function, we need to work with dependencies asynchronously.
approaches, so will affect the performance in larger apps. • It has a very specific and rare use case, which we may never come across. • Obx < GetX < GetBuilder < MixinBuilder
so we can configure how dependency in term of memory management (1) SmartManagement.full • It disposes classes that are not being used and are not perment (2) SmartManagement.onlyBuilder • Only controller started with init or loaded into bind with 'lazyput' will be disposed (3) SmartManagement.keepFactory • Same as full but it will recreate dependency when needed
• doesn't have to be dependent on code generation • Getx has its own dependency injection manager • Bloc 2 dependency, Mobx 4 dependency but with getx only 1 • With getx the state is independent from the widget tree
First, we need GetMaterialApp() Syntax • Get.to(NextScreen()); • Get.toNamed('/details'); • Get.back(); • Get.off(NextScreen()); //To go to the next screen and no option to go back to the previous screen • Get.offAll(NextScreen()); //To go to the next screen and cancel all previous routes • Get.offUntil();// same as pushAndRemoveUntil • Get.offNamedUntil()// same for named routes
has a controller getter, simple as that. If we have a single controller as a dependency, we can use GetView instead of StatelessWidget and avoid writing Get.find. • GetWidget is very similar to GetView with one tiny difference — it gives us the same instance of Get.find every time. This becomes surprisingly useful when used in combination with Get.create, as we can have multiple widgets interact with the same instance of a dependency.