updateRecommendationNode function

Future updateRecommendationNode(
  1. dynamic type
)

Implementation

Future updateRecommendationNode(var type) async {
  var uuid = '';

  type == Types.users ? uuid = Storage.userUUID : uuid = Storage.deviceUUID;

  try {
    var recommendationNode = await Storage.controller!.get(':$type:' +
        uuid +
        ':' +
        Storage.geigerIndicatorUUID +
        ':data:recommendations');

    var threatRecoList = await crtRecommendation(type);

    for (NodeValue tr in threatRecoList) {
      await recommendationNode.addValue(tr);
    }

    //print(RecommendationNode);
    try {
      Storage.controller!.update(recommendationNode);
    } catch (e) {
      // ignore: avoid_print
      print(e);
    }
  } catch (e) {
    // ignore: avoid_print
    print(e);
    return;
  }
}