This repository has been archived on 2023-11-13. You can view files and clone it, but cannot push or open issues or pull requests.
imagini/web_native/lib/core/imagini_application.dart

40 lines
1.2 KiB
Dart
Raw Normal View History

2021-02-11 20:47:42 +00:00
import 'package:fluro/fluro.dart';
import 'package:imagini/core/app_routes.dart';
import 'package:imagini/api/api_provider.dart';
import 'package:imagini/api/imagini_api_repository.dart';
2021-02-20 19:10:25 +00:00
import 'package:imagini/core/storage_client/base_storage_client.dart';
import 'package:imagini/core/storage_client/storage_client.dart'
if (dart.library.html) 'package:imagini/core/storage_client/browser_storage_client.dart'
if (dart.library.io) 'package:imagini/core/storage_client/mobile_storage_client.dart';
2021-02-11 20:47:42 +00:00
class ImaginiApplication {
FluroRouter router;
ImaginiAPIRepository imaginiAPI;
2021-02-20 19:10:25 +00:00
BaseStorageClient storageClient;
2021-02-11 20:47:42 +00:00
Future<void> onCreate() async {
_initRouter();
2021-02-20 19:10:25 +00:00
_initStorageClient();
2021-02-11 20:47:42 +00:00
_initAPIRepository();
}
Future<void> onTerminate() async {}
_initRouter() {
router = new FluroRouter();
AppRoutes.configureRoutes(router);
}
2021-02-20 19:10:25 +00:00
_initStorageClient() {
storageClient = getStorageClient();
}
2021-02-11 20:47:42 +00:00
_initAPIRepository() {
2021-02-20 19:10:25 +00:00
// TODO: Get from config
APIProvider apiProvider = new APIProvider(storageClient);
2021-02-11 20:47:42 +00:00
imaginiAPI = ImaginiAPIRepository(apiProvider);
}
}