createProfiles function

Future createProfiles()

Implementation

Future createProfiles() async{

  //":Global:profiles"
  Node profiles = NodeImpl('profiles','',':Global');
//  try {
//    await Storage.controller!.addOrUpdate(profiles);
//  } catch (e, s) {
//    print(e);
//  }

  //  Map x = json.decode(await File(dirname(Platform.script.path)+'/test/dummyAPI/dummydata/profiles.json').readAsString());


  var t =  data.profiles.entries.iterator;


  while(t.moveNext()){

     var profile = t.current.value;

     Node temp = NodeImpl(profile['UUID'].toString(),'',':Global:profiles');
     await temp.addValue(NodeValueImpl('name', t.current.key));

     var pp =  profile.entries.iterator;

     //print('=========');
     while(pp.moveNext()){

        if(pp.current.key != 'UUID'){

          NodeValue nodeValue = NodeValueImpl(pp.current.key.toString(), pp.current.value.toString());
          await temp.addValue(nodeValue);
          //print(pp.current.key + pp.current.value);
          //log(temp.toString());
        }

     }

     try {
      await profiles.addChild(temp);

      await Storage.controller!.addOrUpdate(profiles);
     } catch (e, s) {
      print(e);
     }

  }


//  var prget = await Storage.controller!.get(':Global:profiles');
//  var datas = await prget.getChildren();
  //log(datas.toString());
  //print(datas.toString());

}