flutter_encryption_helper 0.0.1
flutter_encryption_helper: ^0.0.1 copied to clipboard
Easy-to-use, cross-platform AES-GCM encryption/decryption utilities for Dart and Flutter (Web/WASM, iOS, Android, Windows, macOS, Linux).
flutter_encryption_helper #
Easy-to-use, cross-platform AES-GCM encryption/decryption utilities for Dart and Flutter.
- Platforms: iOS, Android, Web, Windows, macOS, Linux
- WASM compatible: Yes (via
package:cryptography
)
Install #
dart pub add flutter_encryption_helper
Quick start #
import 'dart:convert';
import 'package:cryptography/cryptography.dart';
import 'package:flutter_encryption_helper/flutter_encryption_helper.dart';
Future<void> main() async {
final helper = AesGcmHelper();
final key = await helper.generateKey();
final data = utf8.encode('secret');
final combined = await helper.encrypt(data, secretKey: key);
final clear = await helper.decrypt(combined, secretKey: key);
print(utf8.decode(clear));
}
API Highlights #
AesGcmHelper.generateKey()
– create a secure 256-bit keyAesGcmHelper.encrypt()
– returns nonce + ciphertext + mac combinedAesGcmHelper.decrypt()
– accepts the combined format fromencrypt()
AesGcmHelper.encryptDetached()
– returnsSecretBox
for custom handling
Platforms & WASM #
This package uses package:cryptography
, which provides implementations compatible with Flutter and Web/WASM environments. No native setup required.
License #
MIT © Dhia Bechattaoui