isExpired static method
Tells whether a token is expired.
Returns false if the token is valid, true if it is expired.
Throws FormatException if parameter is not a valid JWT token.
Implementation
static bool isExpired(String token) {
final expirationDate = getExpirationDate(token);
if (expirationDate == null) {
return false;
}
// If the current date is after the expiration date, the token is already expired
return DateTime.now().isAfter(expirationDate);
}