removeData method

void removeData(
  1. String? key
)

Removes a notification from list

Implementation

void removeData(String? key) {
  /// received key Example:
  ///  key: sharelocation-1637059616606602@26juststay
  ///
  if (key == null) {
    return;
  }

  LocationNotificationModel? locationNotificationModel;

  String atsignToDelete = '';
  allLocationNotifications.removeWhere((notification) {
    if (key.contains(
        trimAtsignsFromKey(notification.locationNotificationModel!.key!))) {
      atsignToDelete = notification.locationNotificationModel!.receiver!;
      locationNotificationModel = notification.locationNotificationModel;
    }
    return key.contains(
        trimAtsignsFromKey(notification.locationNotificationModel!.key!));
  });
  notifyListeners();
  // Remove location sharing
  if (locationNotificationModel != null)
  // && (compareAtSign(locationNotificationModel.atsignCreator!, currentAtSign!))
  {
    SendLocationNotification().removeMember(key, [atsignToDelete],
        isExited: true, isAccepted: false, isSharing: false);
  }
}