AppFlowy/app_flowy/lib/home/infrastructure/deps_resolver.dart

48 lines
2.3 KiB
Dart
Raw Normal View History

2021-07-22 04:23:14 +00:00
import 'package:app_flowy/home/application/app/app_bloc.dart';
import 'package:app_flowy/home/application/app/app_watch_bloc.dart';
2021-07-21 07:43:05 +00:00
import 'package:app_flowy/home/application/menu/menu_bloc.dart';
import 'package:app_flowy/home/application/menu/menu_watch.dart';
2021-07-21 07:43:05 +00:00
import 'package:app_flowy/home/infrastructure/i_app_impl.dart';
2021-07-21 09:05:51 +00:00
import 'package:app_flowy/home/infrastructure/i_workspace_impl.dart';
import 'package:app_flowy/home/infrastructure/repos/app_repo.dart';
import 'package:app_flowy/home/infrastructure/repos/workspace_repo.dart';
2021-07-21 07:43:05 +00:00
import 'package:get_it/get_it.dart';
class HomeDepsResolver {
static Future<void> resolve(GetIt getIt) async {
//App
2021-07-21 09:05:51 +00:00
getIt.registerFactoryParam<AppRepository, String, void>(
(appId, _) => AppRepository(appId: appId));
getIt.registerFactoryParam<AppWatchRepository, String, void>(
(appId, _) => AppWatchRepository(appId: appId));
2021-07-21 14:41:44 +00:00
getIt.registerFactoryParam<IApp, String, void>(
(appId, _) => IAppImpl(repo: getIt<AppRepository>(param1: appId)));
getIt.registerFactoryParam<IAppWatch, String, void>((appId, _) =>
IAppWatchImpl(repo: getIt<AppWatchRepository>(param1: appId)));
//workspace
getIt.registerFactoryParam<WorkspaceRepo, String, void>(
(workspaceId, _) => WorkspaceRepo(workspaceId: workspaceId));
getIt.registerFactoryParam<WorkspaceWatchRepo, String, void>(
(workspaceId, _) => WorkspaceWatchRepo(workspaceId: workspaceId));
2021-07-21 14:41:44 +00:00
getIt.registerFactoryParam<IWorkspace, String, void>((workspacId, _) =>
IWorkspaceImpl(repo: getIt<WorkspaceRepo>(param1: workspacId)));
getIt.registerFactoryParam<IWorkspaceWatch, String, void>((workspacId, _) =>
IWorkspaceWatchImpl(
repo: getIt<WorkspaceWatchRepo>(param1: workspacId)));
2021-07-21 07:43:05 +00:00
//Bloc
2021-07-21 14:41:44 +00:00
getIt.registerFactoryParam<MenuBloc, String, void>(
(workspaceId, _) => MenuBloc(getIt<IWorkspace>(param1: workspaceId)));
getIt.registerFactoryParam<MenuWatchBloc, String, void>((workspaceId, _) =>
MenuWatchBloc(getIt<IWorkspaceWatch>(param1: workspaceId)));
2021-07-22 04:23:14 +00:00
getIt.registerFactoryParam<AppBloc, String, void>(
(appId, _) => AppBloc(getIt<IApp>(param1: appId)));
getIt.registerFactoryParam<AppWatchBloc, String, void>(
(appId, _) => AppWatchBloc(getIt<IAppWatch>(param1: appId)));
// AppWatchBloc
2021-07-21 07:43:05 +00:00
}
}