loadAppConfig function

Future<void> loadAppConfig([
  1. String package = ''
])

Function used to read application.yaml from resources/config directory.

the parameter package is optionally used to determine whether the configuration should be loaded inside a module or not.

Implementation

Future<void> loadAppConfig([String package = '']) async {
  var stringConfig =
      await loadConfig(package + KareeConstants.kApplicationRessourceFile);
  try {
    _appConfig = loadYaml(stringConfig);
    _appConfig.forEach((key, value) {
      _loadYamlMap(key, value);
    });
  } catch (e) {
    var newConfig = loadYaml(stringConfig);
    newConfig.forEach((key, value) {
      _loadYamlMap(key, value);
    });
  }
}