You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.6 KiB

import 'package:get/get.dart';
import '../../core/controllers/app_controller.dart';
import '../../core/controllers/permission_controller.dart';
import '../../modules/home/controllers/home_controller.dart';
import '../../modules/explore/controllers/explore_controller.dart';
import '../../modules/profile/controllers/profile_controller.dart';
import '../../data/services/volcano_tts_service.dart';
import '../../data/services/audio_service.dart';
import '../../data/services/notification_service.dart';
import '../../data/services/voice_recognition_service.dart';
import '../../data/services/volcano_ai_service.dart';
/// 初始绑定,用于管理全局依赖
class InitialBinding extends Bindings {
@override
void dependencies() {
// 初始化所有服务
final notificationService = Get.put(NotificationService(), permanent: true);
final voiceRecognitionService = Get.put(VoiceRecognitionService(), permanent: true);
final volcanoTtsService = Get.put(VolcanoTtsService(), permanent: true);
final audioService = Get.put(AudioServiceManager(), permanent: true);
final volcanoAiService = Get.put(VolcanoAIService(), permanent: true);
// 注册 Controllers
Get.put(AppController(), permanent: true);
Get.put(HomeController(), permanent: true);
Get.put(ExploreController(), permanent: true);
Get.put(ProfileController(), permanent: true);
Get.put(PermissionController(), permanent: true);
// 异步初始化
Future.wait([
notificationService.init(),
voiceRecognitionService.onInit(),
// 如果其他服务也需要异步初始化,在这里添加
]);
}
}