start method
Starts the APIRoot instance.
Implementation
FutureOr<bool> start() {
var started = _started;
if (started != null) {
if (started) return true;
var starting = _starting;
if (starting != null) {
return starting;
}
}
_started = false;
_stopped = null;
var retApiRoot = getAPIRoot();
return _starting = retApiRoot.resolveMapped((apiRoot) {
_log.info(
"** Starting APIRoot: ${apiRoot.toString(withModulesNames: false)}");
return _preInitialize().resolveMapped((preInitOk) {
if (!preInitOk) {
throw StateError("Pre-initialization error.");
}
return apiRoot.ensureInitialized().resolveMapped((initResult) {
_started = true;
_starting = null;
return initResult.ok;
});
});
});
}