loadConfig method
void
loadConfig(
[ - String? path
])
Implementation
void loadConfig([String? path]) {
try {
if (path != null && path != Kstrings.demoConfigPath) {
persistConfigPath(path);
}
if (path == Kstrings.demoConfigPath) {
_configPath = _getPersistedConfigPath() ?? 'config.yaml';
} else {
_configPath = path ?? _getPersistedConfigPath() ?? 'config.yaml';
}
final configFile = File(_configPath);
if (configFile.existsSync()) {
final yamlString = configFile.readAsStringSync();
final yamlData = loadYaml(yamlString);
_appConfig = AppConfigModel.fromYaml(yamlData);
} else {
print('⚠️ Config file not found.');
return;
}
} catch (e) {
print('⚠️ Config file not found. $e');
exit(0);
}
}