initialize method
initializes the model by starting brokers
Implementation
@override
Future<void> initialize() async {
// initialize should only run once
if (initialized.isCompleted || _initializing.isCompleted) return;
// signal initializing in progress
_initializing.complete(true);
// base URL changes (fragment is dropped) if
// used past this point
baseUrl = Uri.base.toString();
// initialize folders
await _initFolders();
// initialize platform
await Platform.init();
// initialize System Globals
await _initBindables();
// initialize connection monitor
// this needs to be done ahead of initializing apps
// since they use the template manager
await Connection.initialize(_connected);
// initialize the database (Hive)
await _initDatabase();
// load apps
await _loadApps();
// start the Post Master
postmaster.start();
// start the Janitor
janitor.start();
// add keyboard listener
ServicesBinding.instance.keyboard.addHandler(onShortcutHandler);
// the mouse isn't always detected at startup
// not until the moves it or clicks
// this routine traps that
RendererBinding.instance.mouseTracker.addListener(onMouseDetected);
// set fml2js
Platform.fml2js(version: FmlEngine.version);
// launch the application
await launchApplication(currentApp, navigate: false);
// signal complete
initialized.complete(true);
}