Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup locator #73

Merged
merged 1 commit into from
Nov 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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