getExistScoreNodes function

Future getExistScoreNodes(
  1. dynamic type,
  2. dynamic path
)

Implementation

Future getExistScoreNodes(var type, var path) async {
  var uuid = '';
  type == Types.users ? uuid = Storage.userUUID : uuid = Storage.deviceUUID;

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

    if (path == Types.geigerScoreUser || path == Types.geigerScoreDevice) {
      CoreValues.existReco =
          node.getValue('implementedRecommendations').toString().split(',');
    }
  } catch (e) {
    //Creation
    // ignore: avoid_print
    print('\n');
    // ignore: avoid_print
    print('ScoreNode : $type is not found');

    if (path == Types.geigerScoreUser ||
        path == Types.geigerScoreDevice ||
        path == Types.geigerScoreAggregate) {
      // ignore: avoid_print
      print(path);
      await createScoreNode(type, path); //initailzation
    } else if (path == Types.geigerScoreMSE) {
      await createScoreMSENode(type, path);
    } else if (path == Types.recommendations) {
      await createRecommendationNode(type);
    }
  }
}