0 purchases
binary map file
BinaryMapFile #
Performant key-value store using file system in pure Dart, secured support.
Getting Started #
To get started, simply import the binary_map_file package:
import "dart:io";
import 'package:binary_map_file/binary_map_file.dart';
final file = File(path),
final binaryMapFile = BinaryMapFile(file, secured: false);
await binaryMapFile.ensureInitialized();
// if you want a secured serialization, set the flag secured to `true`
final map = binaryMapFile.map;
copied to clipboard
Get value #
Get the bool value for key firstRun, if the key is not set or null, then reset the value in map to default value and return gotten value
final firstRun = binaryMapFile.getDefaultValue<bool>('firstRun' , true); //
// or
final value = binaryMapFile.getValue<bool>('firstRun'); // boolean or null
copied to clipboard
Set value #
binaryMapFile.setValue<bool>('firstRun', false);
copied to clipboard
Check containing key #
final existed = binaryMapFile.containsKey('firstRun');
copied to clipboard
Serialize #
Save the current map to file
await binaryMapFile.serialize();
copied to clipboard
Supported data types #
Support all data types which MessageCodec using the Flutter standard binary encoding.
Supported messages are acyclic values of these forms:
null
bools
nums
Strings
Uint8Lists, Int32Lists, Int64Lists, Float64Lists
Lists of supported values
Maps from supported values to supported values
License #
This library is licensed under the MIT License. Feel free to use it and contribute to its development.
Made with ❤️ by Annotium
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.