BinaryMapFile
Performant key-value store using file system in pure Dart, secured support.
More power alternative to shared_preference.
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;
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
Set value
binaryMapFile.setValue<bool>('firstRun', false);
Check containing key
final existed = binaryMapFile.containsKey('firstRun');
Serialize
Save the current map to file
await binaryMapFile.serialize();
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