Skip to content
pubscout

flutter_session_jwt

1.2.0, released 3 months ago by an unverified publisher

Store and decode JWT tokens securely on device with helper methods for expiration and refresh flows.

WASM-readyUnverified publisher
$ flutter pub add flutter_session_jwt
Source repository

What it does

It stores JWT and refresh tokens using secure storage, decodes their payloads, and provides helper methods to check expiration dates, token age, and token validity without manual base64 parsing.

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

Use it when

  • You need to store and manage authentication JWTs and refresh tokens securely
  • You need a quick way to check if a token is expired or extract its payload and expiration date

Skip it when

  • You require complex cross-platform state management solutions beyond authentication sessions

Strengths

  • Simplifies JWT payload decoding and expiration checking
  • Built-in support for access and refresh token pairs
  • Allows inspecting tokens directly without touching secure storage

Weaknesses

  • Relies on device secure storage which can occasionally require platform-specific configuration
  • Does not handle full OAuth or credential exchange flows on its own

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
1

Requires adding the package dependency to pubspec.yaml and ensuring standard platform secure storage dependencies are configured.

import 'package:flutter_session_jwt/flutter_session_jwt.dart';

// Save a token after login
await FlutterSessionJwt.saveToken(token);

// Retrieve payload
var payload = await FlutterSessionJwt.getPayload();

// Check if expired
bool expired = await FlutterSessionJwt.isTokenExpired();

Alternatives

Packages that do the same job and could replace flutter_session_jwt.

Works with

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