isExpired method Null safety
- EngineNotification notification
Check if a notification
is expired based on valid age and creation time
Implementation
bool isExpired(EngineNotification notification) {
if (notification.createdUtc.isEmpty ||
notification.validAge == Duration.zero) {
return false;
}
try {
final createdAt = DateTime.parse(notification.createdUtc);
return DateTime.now().isAfter(createdAt.add(notification.validAge));
} on Error {
return false;
}
}