/// Configuration de l'injection de dépendances pour le module Organisations library organisations_di; import 'package:dio/dio.dart'; import 'package:get_it/get_it.dart'; import '../data/repositories/organisation_repository.dart'; import '../data/services/organisation_service.dart'; import '../bloc/organisations_bloc.dart'; /// Configuration des dépendances du module Organisations class OrganisationsDI { static final GetIt _getIt = GetIt.instance; /// Enregistre toutes les dépendances du module static void registerDependencies() { // Repository _getIt.registerLazySingleton( () => OrganisationRepositoryImpl(_getIt()), ); // Service _getIt.registerLazySingleton( () => OrganisationService(_getIt()), ); // BLoC - Factory pour permettre plusieurs instances _getIt.registerFactory( () => OrganisationsBloc(_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 OrganisationsBloc getOrganisationsBloc() { return _getIt(); } /// Obtient une instance du service static OrganisationService getOrganisationService() { return _getIt(); } /// Obtient une instance du repository static OrganisationRepository getOrganisationRepository() { return _getIt(); } }