9 changed files with 35 additions and 36 deletions
@ -1,14 +0,0 @@ |
|||||||
import 'package:get/get.dart'; |
|
||||||
import 'package:problem_check_system/data/repositories/auth_repository.dart'; |
|
||||||
import 'package:problem_check_system/modules/auth/controllers/auth_controller.dart'; |
|
||||||
|
|
||||||
class AuthBinding implements Bindings { |
|
||||||
@override |
|
||||||
void dependencies() { |
|
||||||
// 2. 注入控制器 (AuthController),它依赖于 AuthProvider |
|
||||||
// 控制器通过 Get.find() 获取已注入的依赖 |
|
||||||
Get.lazyPut<AuthController>( |
|
||||||
() => AuthController(authRepository: Get.find<AuthRepository>()), |
|
||||||
); |
|
||||||
} |
|
||||||
} |
|
@ -0,0 +1,12 @@ |
|||||||
|
import 'package:get/get.dart'; |
||||||
|
import 'package:problem_check_system/data/repositories/auth_repository.dart'; |
||||||
|
import 'package:problem_check_system/modules/auth/controllers/login_controller.dart'; |
||||||
|
|
||||||
|
class LoginBinding implements Bindings { |
||||||
|
@override |
||||||
|
void dependencies() { |
||||||
|
Get.lazyPut<LoginController>( |
||||||
|
() => LoginController(authRepository: Get.find<AuthRepository>()), |
||||||
|
); |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue