jwtiot 0.0.1 copy "jwtiot: ^0.0.1" to clipboard
jwtiot: ^0.0.1 copied to clipboard

Jwtson allows you to decode/encode, verify and generate JWT. this plugin referenfe from https://jwt.io/

jwtio #

A new Flutter plugin project.

Getting Started #

This project is a starting point for a Flutter plug-in package, a specialized package that includes platform-specific implementation code for Android and/or iOS.

For help getting started with Flutter development, view the online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Example #

import 'package:flutter/material.dart';
import 'package:jwtio/jwtio.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final _jwtioPlugin = Jwtio();

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('JwtIo example app'),
        ),
        body: Center(
          child: ElevatedButton(
              onPressed: () async {
                // generate and sign jwt token
                var token = await _jwtioPlugin
                    .generateToken(key: "secret", body: {"key": "body"}, header: {"key": "header"});
                print(token);
                // decode jwt token
                var decode = await _jwtioPlugin.decodeJwtToken(key: "secret", tokenJwt: token);
                print(decode?.toJson());
              },
              child: const Text('click me')),
        ),
      ),
    );
  }
}


0
likes
110
points
18
downloads

Publisher

unverified uploader

Weekly Downloads

Jwtson allows you to decode/encode, verify and generate JWT. this plugin referenfe from https://jwt.io/

Homepage

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

dart_jsonwebtoken, flutter, plugin_platform_interface

More

Packages that depend on jwtiot