isExpired property

bool isExpired

Returns 'true` if the token is expired or will expire in the next 10 seconds.

The 10 second buffer is to account for latency issues.

Implementation

bool get isExpired {
  if (expiresAt == null) return false;
  return DateTime.now().add(Constants.expiryMargin).isAfter(
        DateTime.fromMillisecondsSinceEpoch(expiresAt! * 1000),
      );
}