Skip to content
pubscout

jwt_decoder

2.0.1, released 6 years ago by an unverified publisher

Decode Json Web Tokens and check expiration status without a password.

WASM-readyUnverified publisher
$ flutter pub add jwt_decoder
Source repository

What it does

Decodes JSON Web Tokens (JWT) base64-encoded headers and payloads into a Map. Provides utility methods to check if a token is expired, retrieve its expiration date, check token age, and get remaining time.

AI-written summary of version 2.0.1, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to inspect JWT payload data on the client side
  • You need to check token expiration or remaining time in Dart or Flutter

Skip it when

  • You need to cryptographically verify or sign JWT signatures on the client

Strengths

  • Lightweight with no external dependencies
  • Works across all platforms including Dart-only environments
  • Simple static methods for quick decoding and expiration checks

Weaknesses

  • Does not verify the cryptographic signature of the token
  • Throws FormatException on invalid tokens instead of returning null

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0
String yourToken = "Your JWT";
Map<String, dynamic> decodedToken = JwtDecoder.decode(yourToken);
bool hasExpired = JwtDecoder.isExpired(yourToken);

Alternatives

Packages that do the same job and could replace jwt_decoder.

Works with

Packages commonly used together with jwt_decoder: ones it builds on, ones built on it, and its own family.