parseJwt static method
Implementation
static Map<String, dynamic> parseJwt(String token) {
final parts = token.split('.');
if (parts.length != 3) {
throw const FormatException('Invalid token.');
}
final payload = _decodeBase64(parts[1]);
final payloadMap = json.decode(payload);
if (payloadMap is! Map<String, dynamic>) {
throw const FormatException('Invalid payload.');
}
return payloadMap;
}