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

25 lines
970 B
Dart
Raw Normal View History

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:05:51 +00:00
getIt.registerLazySingleton<WorkspaceRepository>(
() => WorkspaceRepository());
getIt.registerFactoryParam<AppRepository, String, void>(
(appId, _) => AppRepository(appId: appId));
2021-07-21 07:43:05 +00:00
//Interface implementation
getIt.registerFactory<IApp>(() => IAppImpl(repo: getIt<AppRepository>()));
2021-07-21 09:05:51 +00:00
getIt.registerFactory<IWorkspace>(
() => IWorkspaceImpl(repo: getIt<WorkspaceRepository>()));
2021-07-21 07:43:05 +00:00
//Bloc
2021-07-21 09:05:51 +00:00
getIt.registerFactory<MenuBloc>(() => MenuBloc(getIt<IWorkspace>()));
2021-07-21 07:43:05 +00:00
}
}