isExpired method

bool isExpired([
  1. DateTime? now
])

Returns true if expiresAt is non-null and not in the future.

now is optional — supplying it makes tests deterministic.

Implementation

bool isExpired([DateTime? now]) {
  final exp = expiresAt;
  if (exp == null) return false;
  final n = now ?? DateTime.now();
  return !n.isBefore(exp);
}