getAllLocationData method

Future<void> getAllLocationData()

get all 'location-notify' data shared with us

Implementation

Future<void> getAllLocationData() async {
  var response = await atClientInstance.getKeys(
    regex: locationKey,
  );
  if (response.isEmpty) {
    return;
  }

  await Future.forEach(response, (dynamic key) async {
    if (('@$key'.contains('cached')) && ('@$key'.contains(currentAtSign!))) {
      var atKey = getAtKey(key);
      AtValue? _atValue = await getAtValueFromMainApp(atKey);
      if ((_atValue != null) && (_atValue.value != null)) {
        try {
          var _locationDataModel =
              LocationDataModel.fromJson(jsonDecode(_atValue.value));
          _locationReceivedData[_locationDataModel.sender] =
              _locationDataModel;
        } catch (e) {
          _logger.severe('Error in getAllLocationData $e');
        }
      }
    }
  });

  createHybridFromLocationDataModel();
}