getThreats method
@param optional language as string @return list of threats from localStorage
Implementation
Future<List<Threat>> getThreats({String language: "en"}) async {
List<Threat> t = [];
try {
_node = await _storageController.get(":Global:threats");
//return _node!.getChildNodesCsv();
for (String threatId in await _node!
.getChildNodesCsv()
.then((value) => value.split(','))) {
Node threatNode =
await _storageController.get(":Global:threats:$threatId");
t.add(Threat(
threatId: threatId,
name: await threatNode
.getValue("name")
.then((value) => value!.getValue(language)!)));
}
} on StorageException {
rethrow;
}
return t;
}