JwtPayload class
Typed container for JWT claims.
Standard registered claims (sub, iss, aud, exp, nbf, iat,
jti) are available as named parameters. Custom claims (e.g. role,
tenantId) are passed via extra.
final payload = JwtPayload(
sub: 'user123',
exp: DateTime.now().millisecondsSinceEpoch ~/ 1000 + 300, // 5 min
extra: {'role': 'admin'},
);
Constructors
Properties
- aud → String?
-
Audience — identifies the recipients this token is intended for.
final
- exp → int?
-
Expiration — Unix timestamp (seconds) after which the token is invalid.
final
-
extra
→ Map<
String, dynamic> -
Custom / application-specific claims.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- iat → int?
-
Issued-at — Unix timestamp when the token was issued.
final
- iss → String?
-
Issuer — identifies who issued the token.
final
- jti → String?
-
JWT ID — unique identifier for the token.
final
- nbf → int?
-
Not-before — Unix timestamp before which the token must not be used.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sub → String?
-
Subject — identifies the principal this token is about.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toMap(
) → Map< String, dynamic> - Converts this payload to a plain Map suitable for encoding.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited