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

Using RnCrypt with Native Dependency create a flutter plugin.

encrypt_decrypt #

Platform Support #

Android iOS

Usage #

import 'package:flutter/material.dart';
import 'package:rn_encrypt_decrypt/rn_encrypt_decrypt.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 _rnEncryptDecryptPlugin = RnEncryptDecrypt();
  final TextEditingController _textMessageToEncrypt=TextEditingController(text: 'I am a software Developer with keen interest to learn new tech.');
  final TextEditingController _textKey=TextEditingController(text: 'techgeek.cloud');
  //Map Data to Encrypt


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

  _encryption({required String key, required String data}) {
    return _rnEncryptDecryptPlugin.encrypt(key,data);
  }

  _decryption({required String key, required String data}) {
    return _rnEncryptDecryptPlugin.decrypt(key,data);
  }

  String displayData = "";

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Encrypt Decrypt',
      home: Scaffold(
        appBar: AppBar(
          title: const Text('RnCrypt App'),
        ),
        body: Padding(
          padding: const EdgeInsets.all(8.0),
          child: Column(
            mainAxisSize: MainAxisSize.max,
            mainAxisAlignment: MainAxisAlignment.center,
            crossAxisAlignment: CrossAxisAlignment.center,
            children: [
              TextFormField(controller: _textKey),
              const SizedBox(height: 10,),
              TextField(controller: _textMessageToEncrypt,maxLines: 4),
              const SizedBox(height: 10,),
              Text(
                displayData,
              ),
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                crossAxisAlignment: CrossAxisAlignment.center,
                children: [
                  FilledButton(
                    onPressed: () async {
                      /// Encode your data into with [jsonEncode] before encrpting it
                      displayData = await _encryption(key: _textKey.text, data: _textMessageToEncrypt.text);
                      setState(() {});
                    },
                    child: const Text('Perform Encryption'),
                  ),
                  FilledButton(
                    onPressed: () async {
                      await _decryption(key: _textKey.text, data: displayData);
                      _textMessageToEncrypt.text=await _decryption(key: _textKey.text, data: displayData);
                      setState(() {});
                    },
                    child: const Text('Perform Decryption'),
                  ),
                ],
              )
            ],
          ),
        ),
      ),
    );
  }
}
2
likes
150
points
22
downloads

Publisher

unverified uploader

Weekly Downloads

Using RnCrypt with Native Dependency create a flutter plugin.

Repository (GitHub)
View/report issues

Documentation

API reference

License

GPL-3.0 (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on rn_encrypt_decrypt

Packages that implement rn_encrypt_decrypt