initialize method
Implementation
@override
Future<bool> initialize() async {
// build stash
stash = Scope(id: 'STASH');
if (domain != null) _stash = await Stash.get(domain!);
for (var entry in _stash.map.entries) {
stash.setObservable(entry.key, entry.value);
}
// add SYSTEM scope
scopeManager.add(System().scope!);
// add THEME scope
scopeManager.add(System.theme.scope!);
// add STASH scope
scopeManager.add(stash);
// add USER scope
scopeManager.add(_user.scope!);
// add GLOBAL alias to this scope
scopeManager.add(scope!, alias: "GLOBAL");
// build config
var config = await _getConfig(true);
if (config != null) _config = config;
// get global template
// get global.xml
if (domain != null) {
var uri = Uri.tryParse(domain!)?.setPage("global.xml");
XmlDocument? template;
if (uri != null) {
template = await Template.fetchTemplate(url: uri.url, refresh: true);
}
// deserialize the returned template
if (template != null) deserialize(template.rootElement);
}
return true;
}