Skip to content

annotium/binary_map_file

Repository files navigation

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;

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:

License

This library is licensed under the MIT License. Feel free to use it and contribute to its development.


Made with ❤️ by Annotium

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published