jwt 0.1.4

  • README.md
  • Installing
  • Versions
  • 37

JSON Web Token

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 JavaScript Object Notation (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 MACed and/or encrypted.

The JWT spec is implemented as a standard Dart Codec.

Example usage

import 'package:jwt/json_web_token.dart';

// Encode (i.e. sign) a payload into a JWT token.

final jwt = new JsonWebTokenCodec(secret: "My secret key");
final payload = {
  'iss': 'joe',
  'exp': 1300819380,
  'http://example.com/is_root': true
final token = jwt.encode(payload);

// Validate a token.


// Decode (i.e. extract) the payload from a JWT token.

final payload = jwt.decode(token);


The API is not stable. The intend is to strictly follow Dart conventions, i.e. make the API as 'dartish' as possible while maintaining simplicity. We are open to any suggestions towards that goal.


Copyright (c) 2014 George Moschovitis george.moschovitis@gmail.com.

1. Depend on it

Add this to your package's pubspec.yaml file:

  jwt: "^0.1.4"

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter packages get

Alternatively, your editor might support pub get or packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:jwt/base64.dart';

import 'package:jwt/base64url.dart';

import 'package:jwt/json_web_signature.dart';

import 'package:jwt/json_web_token.dart';
Version Uploaded Documentation Archive
0.1.4 Mar 25, 2014 Go to the documentation of jwt 0.1.4 Download jwt 0.1.4 archive


This feature is new.
We welcome feedback.
More details: scoring.

We analyzed this package, and provided a score, details, and suggestions below.

  • tool failures on Jan 21, 2018
  • Dart: 2.0.0-dev.15.0
  • pana: 0.10.0


Describes how popular the package is relative to other packages. [more]
71 / 100
Code health derived from static analysis. [more]
6 / 100
Reflects how tidy and up-to-date the package is. [more]
0 / 100
Overall score:
Weighted score of the above. [more]


Detected platforms: Flutter, web, other

No platform restriction found in libraries.


  • Fix lib/base64url.dart.

    Strong-mode analysis of lib/base64url.dart failed with the following error:

    line: 29 col: 3
    Invalid override. The type of 'Base64UrlEncoder.convert' ('(List<int>) → String') isn't a subtype of 'Converter<dynamic, dynamic>.convert' ('(dynamic) → dynamic').

  • Fix lib/json_web_signature.dart.

    Strong-mode analysis of lib/json_web_signature.dart failed with the following error:

    line: 20 col: 3
    Invalid override. The type of 'JsonWebSignatureEncoder.convert' ('(List<int>, {header: Map<dynamic, dynamic>, secret: String}) → String') isn't a subtype of 'Converter<dynamic, dynamic>.convert' ('(dynamic) → dynamic').

  • Fix further 2 Dart files.

    Similar analysis of the following files failed:

    • lib/json_web_token.dart
    • lib/base64.dart
  • Maintain CHANGELOG.md.

    Changelog entries help clients to follow the progress in your code.

  • Fix issues reported by dartanalyzer.

    dartanalyzer reported 3 error(s) and 0 warning(s).

  • Use constrained dependencies.

    The pubspec.yaml contains 1 dependency without version constraints. Specify version ranges for the following dependencies: crypto.

  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Maintain an example.

    Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use jwt.dart.


Package Constraint Resolved Available
Direct dependencies
crypto any 2.0.2+1
Transitive dependencies
charcode 1.1.1
collection 1.14.5
convert 2.0.1
typed_data 1.1.5
Dev dependencies
unittest any