Docs mirror / Dependency management

GetX dependency injection docs, restored.

The same DI helpers remain available: register eagerly, register lazily, and wire route-level bindings without changing your app architecture.

Register dependencies

Use Get.put for immediate registration.

Immediate registration

service_locator.dart

final authService = Get.put(AuthService());
final controller = Get.put(LoginController(authService));

Lazy registration

Use Get.lazyPut when you want deferred creation.

Lazy registration

bindings.dart

Get.lazyPut<ApiClient>(() => ApiClient());
Get.lazyPut<ProfileController>(() => ProfileController(Get.find()));

Bindings

Keep route setup colocated with route-specific dependencies.

Bindings example

profile_binding.dart

class ProfileBinding extends Bindings {
  @override
  void dependencies() {
    Get.lazyPut<ProfileController>(() => ProfileController(Get.find()));
  }
}