/// Configuration de l'injection de dépendances pour le module Organizations library organizations_di; import 'package:dio/dio.dart'; import 'package:get_it/get_it.dart'; import '../data/repositories/organization_repository.dart'; import '../data/services/organization_service.dart'; import '../bloc/organizations_bloc.dart'; /// Configuration des dépendances du module Organizations class OrganizationsDI { static final GetIt _getIt = GetIt.instance; /// Enregistre toutes les dépendances du module static void registerDependencies() { // Repository _getIt.registerLazySingleton( () => OrganizationRepositoryImpl(_getIt()), ); // Service _getIt.registerLazySingleton( () => OrganizationService(_getIt()), ); // BLoC - Factory pour permettre plusieurs instances _getIt.registerFactory( () => OrganizationsBloc(_getIt()), ); } /// Nettoie les dépendances du module static void unregisterDependencies() { if (_getIt.isRegistered()) { _getIt.unregister(); } if (_getIt.isRegistered()) { _getIt.unregister(); } if (_getIt.isRegistered()) { _getIt.unregister(); } } /// Obtient une instance du BLoC static OrganizationsBloc getOrganizationsBloc() { return _getIt(); } /// Obtient une instance du service static OrganizationService getOrganizationService() { return _getIt(); } /// Obtient une instance du repository static OrganizationRepository getOrganizationRepository() { return _getIt(); } }