JsonWebToken class

A JSON Web Token (JWT) is a compact, URL-safe means of representing claims to be transferred between two parties.

The claims in a JWT are encoded as a JSON object that is used as the payload of a JSON Web Signature (JWS) structure or as the plaintext of a JSON Web Encryption (JWE) structure, enabling the claims to be digitally signed or integrity protected with a Message Authentication Code (MAC) and/or encrypted.

Available Extensions
Annotations
  • @immutable

Constructors

JsonWebToken({String? raw, required JsonWebHeader header, required JsonWebClaims claims, required List<int> signature})
A JSON Web Token (JWT) is a compact, URL-safe means of representing claims to be transferred between two parties.
const
JsonWebToken.parse(String token)
Parses a JSON Web Token.
factory

Properties

claims → JsonWebClaims
The payload, or set of claims, embodied by this JWT.
final
hashCode int
The hash code for this object.
no setterinherited
The JOSE (JSON Object Signing and Encryption) header.
final
props List<Object?>
The type's equatable properties.
no setter
raw String
The raw, encoded JWT string.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
signature List<int>
The signature bytes for this token.
final

Methods

encode() String
Encodes the JWT to a .-delimited string.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() String
Serializes this as a JSON object.
toString() String
A string representation of this object.
override

Operators

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

Static Methods

tryParse(String token) JsonWebToken?
Parses a JSON Web Token, returning null if unsuccessful.