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

outdated

A new flutter plugin project.

example/lib/main.dart

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

import 'package:flutter/services.dart';
import 'package:zsh_encrypt_plugin/zsh_encrypt_plugin.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String originalText = "我爱你中国";
  String aeskey = "asdfghjklzxcvbnm";
  String aesCiphertext;
  String aesDecryptedText;
  String rsaCiphertext;
  String rsaDecryptedText;

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


  Future aes_encode() async{
    String result;
    try {
      result = await ZshEncryptPlugin.aes_encryptString(originalText, aeskey);
      print(result);
      setState(() {
        aesCiphertext = result;
      });
    }on PlatformException{
      print("aes encode error");
    }
  }
  Future aesDecode()async{
    String result;
    try {
      result = await ZshEncryptPlugin.aes_decryptString(aesCiphertext, aeskey);
      print(result);
      setState(() {
        aesDecryptedText = result;
      });
    }on PlatformException{
      print("aes encode error");
    }
  }
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Column(
          children: <Widget>[
            Center(
              child: Text(' original text:$originalText '),
            ),
            FlatButton(onPressed: ()=> {
            aes_encode(),


            }, child: Text('AES Encrypt')),
            Text('aes_Ciphertext: $aesCiphertext'),
            FlatButton(onPressed: ()=>{
              aesDecode()
            }, child: Text('AES Decrypt')),
            Text('aes_DecryptedText: $aesDecryptedText'),

            FlatButton(onPressed: ()=>{

            }, child: Text('RSA Encrypt')),
            FlatButton(onPressed: ()=>{}, child: Text('RSA Decrypt')),

          ],

        )
      ),
    );
  }
}
0
likes
0
pub points
0%
popularity

Publisher

unverified uploader

A new flutter plugin project.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on zsh_encrypt_plugin