component_router_service.dart 855 B

12345678910111213141516171819202122232425262728293031323334
  1. import 'package:get/get.dart';
  2. import 'package:router/componentRouter/auth_service.dart';
  3. import 'package:router/componentRouter/labour_service.dart';
  4. import 'job_service.dart';
  5. import 'report_service.dart';
  6. /**
  7. * 全局的组件路由服务,记得在 main.dart 中注入
  8. */
  9. class ComponentRouterServices{
  10. static final ComponentRouterServices _instance = ComponentRouterServices._internal();
  11. factory ComponentRouterServices() {
  12. return _instance;
  13. }
  14. ComponentRouterServices._internal();
  15. //获取 Labour 组件的服务
  16. static LabourService get labourService => Get.find();
  17. //获取 Job 组件的服务
  18. static JobService get jobService => Get.find();
  19. //获取 Report 组件的服务
  20. static ReportService get reportService => Get.find();
  21. //获取 Auth 组件服务
  22. static AuthService get authService => Get.find();
  23. }