2021-07-21 07:43:05 +00:00
|
|
|
import 'package:app_flowy/home/application/menu/menu_bloc.dart';
|
|
|
|
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 {
|
2021-07-21 09:11:55 +00:00
|
|
|
getIt.registerFactoryParam<WorkspaceRepository, String, void>(
|
|
|
|
(workspaceId, _) => WorkspaceRepository(workspaceId: workspaceId));
|
2021-07-21 09:05:51 +00:00
|
|
|
|
|
|
|
getIt.registerFactoryParam<AppRepository, String, void>(
|
|
|
|
(appId, _) => AppRepository(appId: appId));
|
2021-07-21 07:43:05 +00:00
|
|
|
|
|
|
|
//Interface implementation
|
2021-07-21 14:41:44 +00:00
|
|
|
getIt.registerFactoryParam<IApp, String, void>(
|
|
|
|
(appId, _) => IAppImpl(repo: getIt<AppRepository>(param1: appId)));
|
|
|
|
|
|
|
|
getIt.registerFactoryParam<IWorkspace, String, void>((workspacId, _) =>
|
|
|
|
IWorkspaceImpl(repo: getIt<WorkspaceRepository>(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)));
|
2021-07-21 07:43:05 +00:00
|
|
|
}
|
|
|
|
}
|