1111
This commit is contained in:
@@ -2,6 +2,11 @@ import 'package:dio/dio.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import '../network/api_client.dart';
|
||||
import '../../data/datasources/auth_remote_data_source.dart';
|
||||
import '../../data/datasources/user_local_data_source.dart';
|
||||
import '../../data/repositories/auth_repository_impl.dart';
|
||||
import '../../domain/repositories/auth_repository.dart';
|
||||
import '../../domain/usecases/login_usecase.dart';
|
||||
|
||||
final sl = GetIt.instance;
|
||||
|
||||
@@ -14,26 +19,29 @@ Future<void> initializeDependencies() async {
|
||||
sl.registerLazySingleton<SharedPreferences>(() => sharedPreferences);
|
||||
|
||||
// Core
|
||||
sl.registerLazySingleton<ApiClient>(() => ApiClient(dio: sl()));
|
||||
sl.registerLazySingleton<ApiClient>(
|
||||
() => ApiClient(dio: sl(), sharedPreferences: sl()),
|
||||
);
|
||||
|
||||
// Data sources will be registered here
|
||||
// Example:
|
||||
// sl.registerLazySingleton<AuthRemoteDataSource>(
|
||||
// () => AuthRemoteDataSourceImpl(apiClient: sl()),
|
||||
// );
|
||||
// Data sources
|
||||
sl.registerLazySingleton<AuthRemoteDataSource>(
|
||||
() => AuthRemoteDataSourceImpl(apiClient: sl()),
|
||||
);
|
||||
|
||||
sl.registerLazySingleton<UserLocalDataSource>(
|
||||
() => UserLocalDataSourceImpl(sharedPreferences: sl()),
|
||||
);
|
||||
|
||||
// Repositories will be registered here
|
||||
// Example:
|
||||
// sl.registerLazySingleton<AuthRepository>(
|
||||
// () => AuthRepositoryImpl(
|
||||
// remoteDataSource: sl(),
|
||||
// localDataSource: sl(),
|
||||
// ),
|
||||
// );
|
||||
// Repositories
|
||||
sl.registerLazySingleton<AuthRepository>(
|
||||
() => AuthRepositoryImpl(
|
||||
remoteDataSource: sl(),
|
||||
localDataSource: sl(),
|
||||
),
|
||||
);
|
||||
|
||||
// Use cases will be registered here
|
||||
// Example:
|
||||
// sl.registerLazySingleton(() => LoginUseCase(repository: sl()));
|
||||
// Use cases
|
||||
sl.registerLazySingleton(() => LoginUseCase(repository: sl()));
|
||||
|
||||
// Blocs will be registered here
|
||||
// Example:
|
||||
|
||||
Reference in New Issue
Block a user