mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
29 lines
777 B
Dart
29 lines
777 B
Dart
import 'package:get_it/get_it.dart';
|
|
import 'package:toolbox/data/provider/app.dart';
|
|
import 'package:toolbox/data/provider/debug.dart';
|
|
import 'package:toolbox/data/service/app.dart';
|
|
import 'package:toolbox/data/store/setting.dart';
|
|
|
|
GetIt locator = GetIt.instance;
|
|
|
|
void setupLocatorForServices() {
|
|
locator.registerLazySingleton(() => AppService());
|
|
}
|
|
|
|
void setupLocatorForProviders() {
|
|
locator.registerSingleton(AppProvider());
|
|
locator.registerSingleton(DebugProvider());
|
|
}
|
|
|
|
Future<void> setupLocatorForStores() async {
|
|
final setting = SettingStore();
|
|
await setting.init(boxName: 'setting');
|
|
locator.registerSingleton(setting);
|
|
}
|
|
|
|
Future<void> setupLocator() async {
|
|
await setupLocatorForStores();
|
|
setupLocatorForProviders();
|
|
setupLocatorForServices();
|
|
}
|