requiresRefresh method

bool requiresRefresh({
  1. Duration window = const Duration(minutes: 5),
  2. DateTime? now,
})

Returns true if the token should be refreshed soon.

By default, this checks if the token will expire within the next 5 minutes. Useful for proactive refresh logic without having to manage your own expiry buffer. Pass a custom window to override the default.

Implementation

bool requiresRefresh(
        {Duration window = const Duration(minutes: 5), DateTime? now}) =>
    willExpireWithin(window, now);