You have the JWTError class that extends Error. But, I think, that in this situation, JWTError should implements Exception.
A good explanation you can find here
And also it would be better to rename JWTError to JWTException (and all inheritors too: JWTInvalidError, JWTExpiredError, etc.)
class JWTException implements Exception {
JWTException(this.message);
final String message;
@override
String toString() => 'JWTException: $message';
}