flutter_rust_encrypt

This plugin flutter wrapper plugin for dart_rust_encrypt plugin for the ease of use in flutter.

Installation

To use this plugin, add flutter_rust_encrypt as a dependency in your pubspec.yaml file.

dependencies:
  flutter_rust_encrypt: 

Then run:

flutter pub get

Usage

Import the package in your Dart files:

import 'package:flutter_rust_encrypt/flutter_rust_encrypt.dart';

Initializing and Use

All the functions are static and re-exported from the dart_rust_encrypt plugin, so you can use them directly. Just call FlutterRustEncrypt.init(); before using the plugin to initialize the Rust library.

FlutterRustEncrypt.init(); // Call init() just once
final result = DartRustEncryptSync.sha3_256(testInput); // Or: await DartRustEncryptAsync.sha3_256(testInput);
print("Rust result: $result");

Example

A complete example is in the example folder, also you can see the speed difference between a dart implementation for SHA3-256 (pointycastle package) and the Rust one.

Adding/Updating the Functionality

As this is a wrapper for the dart_rust_encrypt plugin, you can add or update the functionality by updating the dart_rust_encrypt plugin and then building the required library for each platform. For full instruction details please see the dart_rust_encrypt readme.