-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathservice_locator.dart
50 lines (40 loc) · 1.81 KB
/
service_locator.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import 'package:firebase_auth/firebase_auth.dart';
import 'package:firebase_storage/firebase_storage.dart';
import 'package:get_it/get_it.dart';
import 'app_theme.dart';
import 'model/api/server.dart';
import 'model/auth/auth_controller.dart';
import 'model/error_handlers/error_service_plugins/api_error_plugin.dart';
import 'model/managers/cached_loadable_manager.dart';
import 'model/managers/cached_paginated_loadable_manager.dart';
import 'model/services/auth_service.dart';
import 'model/services/error_service.dart';
import 'model/services/media_service.dart';
import 'model/services/navigation_chain_service.dart';
import 'model/services/notification_service.dart';
import 'model/error_handlers/error_service_plugins/firebase_auth_error_plugin.dart';
import 'model/error_handlers/error_service_plugins/info_exception_plugin.dart';
import 'model/services/preferences_service.dart';
final sl = GetIt.instance;
void initLocator() {
//Error service
final ErrorService errorService = ErrorService();
errorService.registerPlugins([
apiErrorPlugin,
infoExceptionPlugin,
firebaseAuthErrorPlugin
]);
sl.registerSingleton(errorService);
sl.registerLazySingleton(() => AuthController( FirebaseAuth.instance ));
sl.registerLazySingleton(() => FirebaseStorage.instance);
sl.registerLazySingleton(() => Server( sl() ));
sl.registerLazySingleton(() => AuthService(FirebaseAuth.instance, sl<Server>()));
sl.registerLazySingleton(() => NotificationService());
sl.registerLazySingleton(() => MediaService());
sl.registerLazySingleton(() => PreferencesService());
sl.registerLazySingleton(() => NavigationChainService());
sl.registerLazySingleton(() => GlobalAppThemeConfig());
//Managers
sl.registerLazySingleton(() => CachedPaginatedLoadableManager());
sl.registerLazySingleton(() => CachedLoadableManager());
}