willExpireWithin method
Returns true if the token will expire within duration from now.
Implementation
bool willExpireWithin(Duration duration, [DateTime? now]) {
final exp = expiresAt;
if (exp == null) return false;
final n = now ?? DateTime.now();
final threshold = n.add(duration);
return !threshold.isBefore(exp);
}