removeData method
Removes a notification from list
Implementation
void removeData(String? key) {
/// received key Example:
/// key: sharelocation-1637059616606602@26juststay
///
if (key == null) {
return;
}
EventNotificationModel? _eventNotificationModel;
List<String> atsignsToRemove = [];
allEventNotifications.removeWhere((notification) {
if (key.contains(
trimAtsignsFromKey(notification.eventNotificationModel!.key!))) {
atsignsToRemove =
getAtsignsFromEvent(notification.eventNotificationModel!);
_eventNotificationModel = notification.eventNotificationModel;
}
return key.contains(
trimAtsignsFromKey(notification.eventNotificationModel!.key!));
});
/// remove from past notifications
allPastEventNotifications.removeWhere((notification) {
return key.contains(
trimAtsignsFromKey(notification.eventNotificationModel!.key!));
});
notifyListeners();
// Remove location sharing
if (_eventNotificationModel != null)
// && (compareAtSign(locationNotificationModel.atsignCreator!, currentAtSign!))
{
SendLocationNotification().removeMember(key, atsignsToRemove,
isExited: true, isAccepted: false, isSharing: false);
}
}