一次大的提交
This commit is contained in:
@@ -1,16 +1,23 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import '../data/datasources/report_remote_datasource.dart';
|
||||
import '../data/datasources/report_remote_datasource_impl.dart';
|
||||
import '../data/repositories/report_repository_impl.dart';
|
||||
import '../domain/repositories/report_repository.dart';
|
||||
import '../domain/usecases/submit_report_usecase.dart';
|
||||
import '../presentation/cubit/report_cubit.dart';
|
||||
import 'package:maibu_satabot_v2/core/app/app_user_cubit.dart';
|
||||
import 'package:maibu_satabot_v2/core/storage/user_storage.dart';
|
||||
|
||||
/// 上报模块依赖注入
|
||||
class ReportDependencyInjector {
|
||||
/// 创建 ReportCubit 实例
|
||||
static ReportCubit createReportCubit() {
|
||||
final sl = GetIt.I;
|
||||
|
||||
// 创建数据源
|
||||
final ReportRemoteDataSource remoteDataSource = ReportRemoteDataSourceImpl();
|
||||
final ReportRemoteDataSource remoteDataSource =
|
||||
ReportRemoteDataSourceImpl();
|
||||
|
||||
// 创建仓储
|
||||
final ReportRepository repository = ReportRepositoryImpl(
|
||||
@@ -18,9 +25,16 @@ class ReportDependencyInjector {
|
||||
);
|
||||
|
||||
// 创建用例
|
||||
final SubmitReportUseCase submitReportUseCase = SubmitReportUseCase(repository);
|
||||
final SubmitReportUseCase submitReportUseCase = SubmitReportUseCase(
|
||||
repository,
|
||||
);
|
||||
|
||||
// 创建 Cubit
|
||||
return ReportCubit(submitReportUseCase: submitReportUseCase);
|
||||
// 创建 Cubit(注入 Dio、AppUserCubit、UserStorage)
|
||||
return ReportCubit(
|
||||
submitReportUseCase: submitReportUseCase,
|
||||
dio: sl<Dio>(),
|
||||
appUserCubit: sl<AppUserCubit>(),
|
||||
userStorage: sl<UserStorage>(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user