main function
main entry point for the app
Implementation
void main() {
AppDebug().startUpTimestamp = DateTime.now()
.millisecondsSinceEpoch; // this isnt that important, but it might be useful lol for calculating how long the user might have had this app up for
WidgetsFlutterBinding.ensureInitialized();
if (Platform.isAndroid || Platform.isFuchsia || Platform.isIOS) {
// pls dont build for these platforms LOL (idrk what happens, prob j build dependency errors)
exit(-1);
} else {
initConsts().then((_) async {
// i know i prob shldnt have "unit tests" in production level code LOL
if (kRunTests) {
__tests();
}
logger.info("kShowDebugView=$kShowDebugView");
// checking platform channel exists
if (!await sanityCheck()) {
throw const NativeException(
"OnTheFly unable to complete native channel sanity checks!");
} else {
logger.info("Platform channel registered");
}
logger.info("Registered jobs: ${JobDispatcher.registeredJobDispatchers}");
// lets do a sanity check for all of the registered jobs just in case
for (MapEntry<Type, Iterable<JobDispatcher>> entry
in JobDispatcher.getJobsByMediumMap.entries) {
logger.info("Jobs for medium ${entry.key}: ${entry.value.length}");
}
// debugRepaintRainbowEnabled = true;
for (int i = 0; i < 2; i++) {
LoaderHandlerView.loads["TestDelay$i"] =
() => Future<void>.delayed(const Duration(milliseconds: 400));
}
LoaderHandlerView.loads["Load all asset bundles"] = Bundles.loadAllBundles;
LoaderHandlerView.loads["Parse configurations"] = PublicBundle.parseConfigurations;
LoaderHandlerView.loads["WinMan Module Load"] = () {
if (PublicBundle.isInitialFocused) {
WinMan.I.requestFocus();
}
};
runApp(RootServiceView(
appView: const AppView(),
onDone: () async {
String? initWinState = PublicBundle.initialWindowState;
doWhenWindowReady(() async {
logger.info("initWinState=$initWinState");
if (initWinState == null || initWinState == "gui") {
appWindow.show();
}
DebugLayerEvents()["xt"] = Wrap(
spacing: 4,
runSpacing: 4,
children: XtRunners.r(),
);
}); // for bitsdojo_window
await initSystemTray();
},
));
});
}
}