getNotifications method
List<AppNotification>
getNotifications({
- bool unreadOnly = false,
- NotificationType? type,
- 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();
}