asString method
Returns a string value given by section
and key
.
key
: the key of the (key value) pair
section
: if given the (key value) pair is searched in this section
defaultValue
: if the key does not exists this value is returned
Implementation
String? asString(String key, {String? section, String? defaultValue}) {
var rc = defaultValue;
Map? map = yamlMap;
if (section != null) {
map = null;
if (yamlMap.containsKey(section)) {
map = yamlMap[section];
}
}
if (map != null && map.containsKey(key)) {
rc = map[key].toString();
}
return rc;
}