getDeviceThreatRecommendation method

Future<List<Recommendation>> getDeviceThreatRecommendation({
  1. String language = "en",
})

get deviceRecommendation from :device node

@param option language as string @param threat object @return list of threatRecommendation object

Implementation

Future<List<Recommendation>> getDeviceThreatRecommendation(
    {String language: "en"}) async {
  Device currentDevice = await getDeviceInfo;

  try {
    _node = await _storageController
        .get(":Devices:${currentDevice.deviceId}:gi:data:recommendations");
    String threatRecommendations = await _node!
        .getValue("deviceRecommendations")
        .then((value) => value!.getValue(language).toString());

    return Recommendation.convertFromJSon(threatRecommendations);
  } on StorageException {
    throw Exception("NODE NOT FOUND");
  }
}