getGeigerScoreDeviceThreatScores method
// @param optional language as string // @return GeigerScore as String from GeigerScoreDevice Node // @throw Node not found on StorageException @param optional language as string @return list of threatScore object from GeigerScoreDevice @throw node not found on StorageException
Implementation
// String getGeigerScoreDevice({String language: "en"}) {
// if (getDeviceInfo != null) {
// Device currentDevice = getDeviceInfo!;
// try {
// _node = _storageController.get(
// ":Devices:${currentDevice.deviceId}:gi:data:GeigerScoreDevice");
//
// String geigerScore =
// _node!.getValue("GEIGER_score")!.getValue(language).toString();
// return geigerScore;
// } on StorageException {
// throw Exception("Node not found");
// }
// } else {
// throw Exception("currentDevice is null ");
// }
// }
/// @param optional language as string
/// @return list of threatScore object from GeigerScoreDevice
/// @throw node not found on StorageException
Future<GeigerScoreThreats> getGeigerScoreDeviceThreatScores(
{String language: "en"}) async {
Device currentDevice = await getDeviceInfo;
try {
_node = await _storageController
.get(":Devices:${currentDevice.deviceId}:gi:data:GeigerScoreDevice");
String geigerScore = await _node!
.getValue("GEIGER_score")
.then((value) => value!.getValue(language).toString());
String threats_score = await _node!
.getValue("threats_score")
.then((value) => value!.getValue(language).toString());
List<ThreatScore> _threatScores =
ThreatScore.convertFromJson(threats_score);
return GeigerScoreThreats(
threatScores: _threatScores, geigerScore: geigerScore);
} on StorageException {
throw Exception("Node not found");
}
}