48 lines
1.1 KiB
Dart
48 lines
1.1 KiB
Dart
import 'package:get_it/get_it.dart';
|
|
import 'package:mc_gallery/features/core/abstracts/router/app_router.dart';
|
|
import 'package:mc_gallery/features/core/services/logging_service.dart';
|
|
import 'package:mc_gallery/features/core/services/navigation_service.dart';
|
|
|
|
GetIt get locate => Locator.instance();
|
|
|
|
class Locator {
|
|
static GetIt instance() => GetIt.instance;
|
|
static T locate<T extends Object>() => instance().get<T>();
|
|
|
|
static Future<void> setup() async {
|
|
final locator = instance();
|
|
|
|
_registerAPIs();
|
|
_registerViewModels();
|
|
_registerLazySingletons();
|
|
_registerFactories();
|
|
|
|
await _registerServices(locator);
|
|
|
|
await _registerRepos(locator);
|
|
_registerSingletons();
|
|
}
|
|
|
|
static void _registerAPIs() {}
|
|
|
|
static void _registerViewModels() {}
|
|
|
|
static void _registerLazySingletons() {}
|
|
|
|
static void _registerFactories() {}
|
|
|
|
static _registerServices(GetIt it) {
|
|
it.registerLazySingleton(
|
|
() => NavigationService(
|
|
mcgRouter: McgRouter.locate,
|
|
),
|
|
);
|
|
it.registerFactory(
|
|
() => LoggingService(),
|
|
);
|
|
}
|
|
|
|
static _registerRepos(GetIt locator) {}
|
|
|
|
static void _registerSingletons() {}
|
|
}
|