Flutter companion package to sodium that provides the low-level libsodium binaries for easy use.
Table of contents
- Extends sodium for Flutter with binaries
- Easy, effort-less initialization on all major flutter platforms (Android, iOS, Linux, Windows, macOS, Web)
- Binaries are either directly included or automatically downloaded/built at compile time
Note: This package only handles the libsodium binaries for each supported platform and provides them to sodium. Check the documentation of that package for more details about the actual APIs.
sodium_libs to your
pubspec.yaml and run
pub get (or
flutter pub get).
In addition to installing the package, you will also have to install operating system specific tools for some platforms:
You have to install libsodium on your system. How you do this depends on your distribution:
[sudo] pacman -S libsodium
[sudo] apt install libsodium-dev
When bundeling the application for release, remember to also include the
libsodium.so into the deployment package.
choco install minisign
The web setup differs slightly from the others. Instead of just installing some
system library, you need to add
sodium.js to each project. You can
do this automatically by running the following command in every new project.
flutter pub run sodium_libs:update_web
The API can be consumed in the excact same way as the
sodium package. The only
difference is, that
sodium_libs simplifies the initialization of that package.
To initialize it, simply do the following:
import 'package:sodium_libs/sodium_libs.dart'; final sodium = await SodiumInit.init(); // You now have a Sodium instance, see sodium package to continue