loadJson method
- String json
Loads the configuration from a serialized JSON representation.
Implementation
void loadJson(String json) {
final decoded = jsonDecode(json) as Map<String, dynamic>;
if (decoded['name'] != name) {
throw RohdHclException('Expect name to be the same.');
}
for (final decodedKnob in (decoded['knobs'] as Map).entries) {
if (!knobs.containsKey(decodedKnob.key)) {
throw RohdHclException('Expect name to be the same.');
}
knobs[decodedKnob.key]!
.loadJson(decodedKnob.value as Map<String, dynamic>);
}
}