Skip to content

Commit

Permalink
Merge pull request #73 from devsadeq/feature/refactor
Browse files Browse the repository at this point in the history
cleanup locator
  • Loading branch information
devsadeq authored Nov 10, 2022
2 parents 6f7a172 + 1f1912e commit bae75ee
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions lib/app/di/locator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,35 +22,43 @@ import '../data/remote/services/search/search_service.dart';
final getIt = GetIt.instance;

Future<void> setupLocator() async {
// Dio
/// Dio Client
getIt.registerSingleton(Dio());
getIt.registerSingleton(DioClient(getIt<Dio>()));
// Storage

/// Storage Service
getIt.registerSingleton(GetStorage());
getIt.registerSingleton(StorageService(getIt<GetStorage>()));
// Job

/// Job Service & Repository
getIt.registerSingleton(JobService(dioClient: getIt<DioClient>()));
getIt.registerSingleton(JobRepository(service: getIt<JobService>()));
// Position Choices

/// Position Service & Repository
getIt.registerSingleton(PositionChoiceService(dioClient: getIt<DioClient>()));
getIt.registerSingleton(
PositionRepository(service: getIt<PositionChoiceService>()));
// Search

/// Search Service & Repository
getIt.registerSingleton(SearchService(dioClient: getIt<DioClient>()));
getIt.registerSingleton(SearchRepository(service: getIt<SearchService>()));
// Company

/// Company Service & Repository
getIt.registerSingleton(CompanyService(dioClient: getIt<DioClient>()));
getIt.registerSingleton(CompanyRepository(service: getIt<CompanyService>()));
// Customer

/// Customer Service & Repository
getIt.registerSingleton(CustomerService(dioClient: getIt<DioClient>()));
getIt
.registerSingleton(CustomerRepository(service: getIt<CustomerService>()));
// Auth
getIt.registerSingleton(CustomerRepository(service: getIt<CustomerService>()));

/// Auth Service & Repository
getIt.registerSingleton(AuthService(dioClient: getIt<DioClient>()));
getIt.registerSingleton(AuthRepository(
authService: getIt<AuthService>(),
storageService: getIt<StorageService>()));
// Application
authService: getIt<AuthService>(),
storageService: getIt<StorageService>(),
));

/// Job Application Service & Repository
getIt.registerSingleton(ApplicationService(dioClient: getIt<DioClient>()));
getIt.registerSingleton(
ApplicationRepository(service: getIt<ApplicationService>()));
Expand Down

0 comments on commit bae75ee

Please sign in to comment.