encryption 0.0.2

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • new46

encryption

A Flutter plugin to encrypt and decrypt a string.

Getting Started

First, add encryption as a dependency in your pubspec.yaml file. Then import 'package:encryption/encryption.dart';

Usage

var _encrypted = await Encryption.getEncryptedString(_password, _string);

var _decrypted = await Encryption.getDecryptedString(_password, _encrypted);

For help getting started with Flutter, view our online documentation.

For help on editing plugin code, view the documentation.

[0.0.1] - TODO: Add release date.

  • TODO: Describe initial release.

example/lib/main.dart

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


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

class MyApp extends StatefulWidget {
  final String data = 'Running on:';
  @override
  _MyAppState createState() => new _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String _password, _string, _encrypted, _decrypted;

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

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'Encryption Plugin',
      home: new Scaffold(
        appBar: new AppBar(
          title: new Text('Encryption Plugin Example'),
        ),
        body: Padding(
          padding: const EdgeInsets.all(16.0),
          child: new Card(
            elevation: 8.0,
            child: Padding(
              padding: const EdgeInsets.all(16.0),
              child: new Column(
                children: <Widget>[
                  new TextField(
                    decoration: new InputDecoration(labelText: 'Password'),
                    onChanged: _passwdChanged,
                  ),
                  new TextField(
                    decoration:
                        new InputDecoration(labelText: 'StringToEncrypt'),
                    onChanged: _stringChanged,
                  ),
                  new Padding(
                    padding: const EdgeInsets.only(top: 38.0),
                    child: new RaisedButton(
                      elevation: 8.0,
                      onPressed: _onPressed,
                      child: new Padding(
                        padding: const EdgeInsets.all(8.0),
                        child: new Text('Click to Encrypt and decrypt'),
                      ),
                    ),
                  ),
                  new Padding(
                    padding: const EdgeInsets.only(top:18.0),
                    child: new Text(
                      _encrypted == null ? '' : _encrypted,
                      style: new TextStyle(fontWeight: FontWeight.bold),
                    ),
                  ),
                  new Padding(
                    padding: const EdgeInsets.only(top:18.0),
                    child: new Text(
                      _decrypted == null ? '' : _decrypted,
                      style: new TextStyle(fontWeight: FontWeight.bold, color: Colors.teal),
                    ),
                  ),
                ],
              ),
            ),
          ),
        ),
      ),
    );
  }

  void _passwdChanged(String value) {
    _password = value;
  }

  void _stringChanged(String value) {
    _string = value;
  }

 _onPressed() async {
    if (_password == null) return null;
    if (_string == null) return null;
    print('###################### _encrypt #####################');
    _encrypted = await Encryption.getEncryptedString(_password, _string);

    print('###################### _decrypt #####################');
    _decrypted = await Encryption.getDecryptedString(_password, _encrypted);
    assert(_string == _decrypted);
    setState(() {});
  }
}

1. Depend on it

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


dependencies:
  encryption: "^0.0.2"

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:encryption/encryption.dart';
        
Version Uploaded Documentation Archive
0.0.2 Apr 14, 2018 Go to the documentation of encryption 0.0.2 Download encryption 0.0.2 archive
0.0.1 Apr 14, 2018 Go to the documentation of encryption 0.0.1 Download encryption 0.0.1 archive

Analysis

We analyzed this package on Apr 23, 2018, and provided a score, details, and suggestions below. Analysis was completed with status tool failures using:

  • Dart: 2.0.0-dev.49.0
  • pana: 0.10.6
  • Flutter: 0.3.2

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
0 / 100
Health:
Code health derived from static analysis. [more]
100 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80 / 100
Overall score:
Weighted score of the above. [more]
46
Learn more about scoring.

Platforms

Detected platforms: unsure

Error(s) prevent platform classification:

Fix dependencies in pubspec.yaml.

Suggestions

  • Fix dependencies in pubspec.yaml.

    Running flutter packages pub upgrade failed with the following output:

    ERR: The current Flutter SDK version is 0.3.2.
     
     Because encryption requires Flutter SDK version ^0.2.8, version solving failed.
    
  • Fix platform conflicts.

    Error(s) prevent platform classification:

    Fix dependencies in pubspec.yaml.

  • 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.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.19.0 <2.0.0