encrypt_decrypt_plus 1.1.0 copy "encrypt_decrypt_plus: ^1.1.0" to clipboard
encrypt_decrypt_plus: ^1.1.0 copied to clipboard

This package helps to encryption and decryption with or without secret key and JWT decode.

example/lib/main.dart

import 'package:encrypt_decrypt_plus/cipher/cipher.dart';
import 'package:flutter/material.dart';

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

class MyApp extends StatefulWidget {
  const MyApp({super.key});

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

class _MyAppState extends State<MyApp> {
  final String _plainTxt = "Hello datadirr";
  String _encryptTxt = "";
  String _decryptTxt = "";
  final Cipher _cipher = Cipher(secretKey: "datadirr");

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: SafeArea(
          child: Center(
            child: Column(
              mainAxisSize: MainAxisSize.min,
              children: [
                Text("plainTxt: $_plainTxt"),
                ElevatedButton(
                    onPressed: () {
                      _encrypt();
                    },
                    child: const Text("Encrypt")),
                Text("encryptTxt: $_encryptTxt"),
                ElevatedButton(
                    onPressed: () {
                      _decrypt();
                    },
                    child: const Text("Decrypt")),
                Text("decryptTxt: $_decryptTxt"),
              ],
            ),
          ),
        ),
      ),
    );
  }

  void _encrypt() async {
    _encryptTxt = _cipher.xorEncode(_plainTxt);
    setState(() {});
  }

  void _decrypt() async {
    _decryptTxt = _cipher.xorDecode(_encryptTxt);
    setState(() {});
  }
}
7
likes
140
pub points
82%
popularity

Publisher

verified publisherdatadirr.com

This package helps to encryption and decryption with or without secret key and JWT decode.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

flutter, flutter_web_plugins, plugin_platform_interface

More

Packages that depend on encrypt_decrypt_plus