getModification method
Get Modification
key : the name of the key relative to modification defaultValue: the returned value if the key is not found
Implementation
dynamic getModification(String key, Object defaultValue,
{bool activate = false}) {
var ret = defaultValue;
if (this.modifications.containsKey(key)) {
try {
var modification = this.modifications[key];
if (modification == null) {
print("Modification value is null, will return default value");
return ret;
}
if (modification.value.runtimeType != defaultValue.runtimeType) {
print(
"Modification value ${modification.value} type ${modification.value.runtimeType} does not match default value type, will return default value");
return defaultValue;
}
ret = modification.value;
if (activate) {
/// send activate later
_sendActivate(modification);
}
} catch (exp) {
print("an exception raised $exp , will return a default value ");
}
}
return ret;
}