refreshNeeded method

bool refreshNeeded({
  1. dynamic secondsToExpiration = 30,
})

Checks if the access token must be refreshed

Implementation

bool refreshNeeded({secondsToExpiration = 30}) {
  var needsRefresh = false;

  if (expirationDate != null) {
    var now = DateTime.now();
    needsRefresh =
        expirationDate!.difference(now).inSeconds < secondsToExpiration;
  }

  return needsRefresh;
}