checkForAlreadyExisting method

List checkForAlreadyExisting(
  1. String? atsign
)

checks if logged in user has already requested location from atsign.

Implementation

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