getEnterpriseUUID function

Future getEnterpriseUUID()

Implementation

Future getEnterpriseUUID() async {
  try {
    var enterpriseNode = await Storage.controller!.get(':Enterprise');

    var getChildren = await enterpriseNode.getChildren();

    var enterpriseNodeIterator = getChildren.entries.iterator;
    var profiles = [];

    while (enterpriseNodeIterator.moveNext()) {
      try {
        var sectorNode =
            await enterpriseNodeIterator.current.value.getValue('sector');
        var sector = sectorNode!.getValue('en');

        var locationNode =
            await enterpriseNodeIterator.current.value.getValue('location');
        var location = locationNode!.getValue('en');

        var profileNode = await enterpriseNodeIterator.current.value
            .getValue('associatedProfiles');
        var profile = profileNode!.getValue('en');
        profiles.add(profile);

        CoreValues.enterpriseNode['sector'] = sector;
        CoreValues.enterpriseNode['location'] = location;
        CoreValues.enterpriseNode['associatedProfiles'] = profile;
      } catch (e) {
        //print(e);
        continue;
      }
    }

    return profiles;
  } catch (e) {
    // ignore: avoid_print
    print(e);
  }
}