JwtPayload class

Decoded JWT payload with typed claim access.

final payload = JwtDecoder.decode(token);
print(payload.subject);    // 'user-123'
print(payload.expiration); // DateTime(...)

Constructors

JwtPayload(Map<String, dynamic> claims)
Create a payload from a claims map.
const

Properties

audience String?
The aud (audience) claim.
no setter
claims Map<String, dynamic>
The raw claims map.
final
expiration DateTime?
The exp (expiration) claim as a DateTime.
no setter
hashCode int
The hash code for this object.
no setterinherited
issuedAt DateTime?
The iat (issued at) claim as a DateTime.
no setter
issuer String?
The iss (issuer) claim.
no setter
notBefore DateTime?
The nbf (not before) claim as a DateTime.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
subject String?
The sub (subject) claim.
no setter

Methods

claim<T>(String key) → T?
Get a custom claim by key, cast to type T.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited