2021-06-19 15:41:19 +00:00
|
|
|
import 'package:app_flowy/startup/launch.dart';
|
|
|
|
import 'package:app_flowy/startup/tasks/prelude.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:get_it/get_it.dart';
|
|
|
|
import 'deps_inject/prelude.dart';
|
|
|
|
|
|
|
|
final getIt = GetIt.instance;
|
|
|
|
enum IntegrationEnv {
|
|
|
|
dev,
|
|
|
|
pro,
|
|
|
|
}
|
|
|
|
|
|
|
|
abstract class AppFactory {
|
|
|
|
Widget create();
|
|
|
|
}
|
|
|
|
|
2021-07-21 14:41:44 +00:00
|
|
|
class Application {
|
2021-06-19 15:41:19 +00:00
|
|
|
static void run(AppFactory f) {
|
|
|
|
// Specify the evn
|
|
|
|
const env = IntegrationEnv.dev;
|
|
|
|
|
|
|
|
// Config the deps graph
|
|
|
|
getIt.registerFactory<AppFactory>(() => f);
|
|
|
|
|
|
|
|
resolveDependencies(env);
|
|
|
|
|
|
|
|
// add task
|
2021-07-03 06:14:10 +00:00
|
|
|
getIt<AppLauncher>().addTask(RustSDKInitTask());
|
2021-06-19 15:41:19 +00:00
|
|
|
getIt<AppLauncher>().addTask(AppWidgetTask());
|
|
|
|
|
|
|
|
// execute the tasks
|
|
|
|
getIt<AppLauncher>().launch();
|
|
|
|
}
|
|
|
|
}
|