compareForMissingInvites method

dynamic compareForMissingInvites(
  1. List<LocationDataModel> _newLocationDataModel
)

looks for newly added LocationDataModel and adds to allAtsignsLocationData.

Implementation

compareForMissingInvites(List<LocationDataModel> _newLocationDataModel) {
  for (var _locationDataModel in _newLocationDataModel) {
    if (allAtsignsLocationData[_locationDataModel.receiver] != null) {
      var _receiverLocationDataModel =
          allAtsignsLocationData[_locationDataModel.receiver]!;

      if (_locationDataModel.locationSharingFor.keys.isEmpty) {
        continue;
      }

      var _id = _locationDataModel.locationSharingFor.keys.first;
      if (_receiverLocationDataModel.locationSharingFor[_id] != null) {
        continue;
      } else {
        _receiverLocationDataModel.locationSharingFor = {
          ..._receiverLocationDataModel.locationSharingFor,
          ..._locationDataModel.locationSharingFor
        };

        if (!_atsignsToSendLocationwith
            .contains(_locationDataModel.receiver)) {
          _atsignsToSendLocationwith.add(_locationDataModel.receiver);
        }
      }
    } else {
      allAtsignsLocationData[_locationDataModel.receiver] =
          _locationDataModel;
    }
  }
}