Simple and powerful reactive state management using GetX.
Reactive and lightweight state management separating business logic from UI using GetX.
lib/app/modules/home/
├── controllers/
│ └── home_controller.dart
├── bindings/
│ └── home_binding.dart
└── views/
└── home_view.dart
GetxController. Store logic and state variables here..obs for observable variables (e.g., final count = 0.obs;).Obx(() => ...) to listen for changes.update() in controller and GetBuilder in UI.Bindings class to decouple DI from UI.Get.lazyPut(() => Controller()) in Bindings.permanent: true.onInit(), onReady(), onClose() instead of initState/dispose.get_cli for modular MVVM (data, models, modules).BuildContext to controllers.Get.put() in widgets; use Bindings + Get.find.class UserController extends GetxController {
final name = "User".obs;
void updateName(String val) => name.value = val;
}
class UserView extends GetView<UserController> {
@override
Widget build(ctx) => Scaffold(
body: Obx(() => Text(controller.name.value)),
floatingActionButton: FloatingActionButton(
onPressed: () => controller.updateName("New"),
),
);
}
For DI Bindings and Reactive patterns: See references/binding-example.md and references/reactive-vs-simple.md.
getx-navigation | feature-based-clean-architecture | dependency-injection