deleteNotification method
Delete a notification from the list.
Implementation
void deleteNotification(String id) {
final int index =
notifications.indexWhere((notification) => notification.id == id);
if (index == -1) return;
final deleted = notifications.removeAt(index);
_listKey.currentState?.removeItem(
index,
(context, animation) => SlideTransition(
position: animation.drive(NotificationList._offset),
child: NotificationWidget(
notification: deleted,
backgroundColor:
backgroundColor ?? Theme.of(context).scaffoldBackgroundColor,
borderColor: borderColor ?? Theme.of(context).primaryColor,
),
),
);
}