feat(config): add ability to set value of multivar variable

This commit is contained in:
Aleksey Kulikov 2021-06-17 17:59:20 +03:00
parent 6a08a7b803
commit 7bea406ab9
3 changed files with 51 additions and 6 deletions

View file

@ -113,7 +113,7 @@ class Config {
/// Map of key/value entries from config file.
Map<String, dynamic> variables = {};
/// Sets value of config key
/// Sets the [value] of config [key]
void setVariable(String key, dynamic value) {
try {
if (value.runtimeType == bool) {
@ -150,6 +150,15 @@ class Config {
return config.getMultivar(configPointer.value, key, regexp);
}
/// Sets the [value] of a multivar [key] in the config file with the
/// highest level (usually the local one).
///
/// The [regexp] is applied case-sensitively on the value.
/// Empty [regexp] sets [value] for all values of a multivar [key]
void setMultivar(String key, String regexp, String value) {
config.setMultivar(configPointer.value, key, regexp, value);
}
/// Releases memory allocated for config object.
void close() {
calloc.free(configPointer);