getAllLocationShareKeys method

dynamic getAllLocationShareKeys()

gets all 'location-notify' keys sent from the logged in atsign.

Implementation

getAllLocationShareKeys() async {
  var allLocationKeyStrings =
      await AtClientManager.getInstance().atClient.getKeys(
            regex: locationKey,
          );

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

  checkForExpiredInvites();
}