getNotifications method

List<AppNotification> getNotifications({
  1. bool unreadOnly = false,
  2. NotificationType? type,
  3. DateTime? since,
})

Returns notifications filtered by the given criteria.

Implementation

List<AppNotification> getNotifications({
  bool unreadOnly = false,
  NotificationType? type,
  DateTime? since,
}) {
  return _notifications.where((n) {
    if (n.dismissed) return false;
    if (n.isExpired) return false;
    if (unreadOnly && n.read) return false;
    if (type != null && n.type != type) return false;
    if (since != null && n.timestamp.isBefore(since)) return false;
    return true;
  }).toList();
}