0 purchases
boxx
Box is a lightweight and blazing fast key-value database written in pure Dart.
Features #
Box is a lightweight storage solution with optional encryption built in. Its simple, powerful, & intuitive API get's you up and running in no time.
Getting started #
Without Encryption
late Box box;
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await initBox();
}
initBox() async {
if (kIsWeb) {
box = Box(path: '');
} else {
final directory = await getApplicationDocumentsDirectory();
box = Box(path: directory.path);
}
}
copied to clipboard
With Encryption
late Box box;
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await initBox();
}
initBox() async {
if (kIsWeb) {
box = Box(path: '',encryptionKey: 'xxxxxxxx',mode: EncryptionMode.aes);
} else {
final directory = await getApplicationDocumentsDirectory();
box = Box(path: directory.path,encryptionKey: 'xxxxxxxx',mode: EncryptionMode.aes);
}
}
copied to clipboard
Usage #
Delete
box.delete('UserData');
copied to clipboard
Get
final contents = await box.get('UserData');
copied to clipboard
Put
box.put('UserData', response.body);
copied to clipboard
Additional information #
Box supports 2 Encryption Algorithms 1) AES Algorithms 2) Fernet Algorithms
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.