At this point in time flutter_sodium implements the following high-level libsodium APIs:
The plugin includes a core API that maps native libsodium functions 1:1 to Dart equivalents. The core API is available in the class
Sodium. Dart naming conventions are used for core API function names. A native libsodium function such as
crypto_pwhash_str, is available in flutter as
Also included in flutter_sodium is a high-level, opinionated API providing access to libsodium in a Dart friendly manner. The various functions are available in separate Dart classes. Password hashing for example is available in the
The high-level API depends on the core API to get things done.
In your flutter project add the dependency:
dependencies: ... flutter_sodium: any
Important: For iOS you'll need to manually update the Podfile in your ios project.
import 'package:flutter_sodium/flutter_sodium.dart'; // Password hashing (using Argon) final password = 'my password'; final str = await PasswordHash.hashStorage(password); print(str); // verify hash str final valid = await PasswordHash.verifyStorage(str, password); assert(valid);
This project includes an extensive example app with runnable code samples. Be sure to check it out!
Add this to your package's pubspec.yaml file:
dependencies: flutter_sodium: ^0.0.5
You can install packages from the command line:
$ flutter packages get
Alternatively, your editor might support
flutter packages get.
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
|0.0.5||Aug 5, 2018|
|0.0.4||Jul 31, 2018|
|0.0.3||Jul 30, 2018|
|0.0.2||Apr 12, 2018|
|0.0.1||Mar 20, 2018|
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
We analyzed this package on Aug 10, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
Detected platforms: Flutter
References Flutter, and has no conflicting libraries.
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 of the API.
Maintain an example.
Create a short demo in the
example/ directory to show how to use this package. Common file name patterns include:
example.dart or you could also use