checkForAlreadyExisting method

List checkForAlreadyExisting(
  1. String? atsign
)

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

Implementation

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