convert method
Converts a JSON string (jsonText) into an EagleEyeConfig object.
The JSON is expected to be an array of configuration items. Invalid entries are skipped if they cannot be parsed.
Implementation
EagleEyeConfig convert(String jsonText) {
List<dynamic> jsonData = jsonDecode(jsonText);
List<EagleEyeConfigItem> eagleConfigItems = [];
for (var jsonDataItem in jsonData) {
final jsonItem = jsonDataItem as Map<String, dynamic>;
_checkKeys(jsonItem.keys.toList());
EagleEyeConfigItem configItem = EagleEyeConfigItem.fromJson(
jsonItem,
);
eagleConfigItems.add(configItem);
}
return EagleEyeConfig(items: eagleConfigItems);
}