isExpiringSoon static method

bool isExpiringSoon(
  1. DateTime? expiresAt, [
  2. Duration threshold = const Duration(minutes: 5)
])

토큰이 곧 만료되는지 확인

threshold 이내에 만료되면 true (기본 5분)

Implementation

static bool isExpiringSoon(
  DateTime? expiresAt, [
  Duration threshold = const Duration(minutes: 5),
]) {
  if (expiresAt == null) return false;
  return DateTime.now().isAfter(expiresAt.subtract(threshold));
}