checkForAlreadyExistingShareLocation method

List checkForAlreadyExistingShareLocation(
  1. String? atsign
)

checks if atsign is already sharing location with logged in user.

Implementation

List checkForAlreadyExistingShareLocation(String? atsign) {
  var index = KeyStreamService().allLocationNotifications.indexWhere((e) =>
      ((e.locationNotificationModel!.atsignCreator == atsign) &&
          (e.locationNotificationModel!.key!
              .contains(MixedConstants.SHARE_LOCATION))));
  if (index > -1) {
    return [
      true,
      KeyStreamService()
          .allLocationNotifications[index]
          .locationNotificationModel
    ];
  } else {
    return [false];
  }
}