A lightning-fast, synchronous, key-value database written in pure Dart.




Tailor is a lightning-speed persistent key-value store for Dart. Using a synchronous, convenient API and an innovative caching system, it is able to write 200,000 objects, read 2 million, and delete 2 million, all in a single second. It is up to 40x faster than the nearest competition.

Features and Performance

  • You can use Tailor synchronously or asynchronously: the core methods (normally synchronous) are available in async form.
  • Hive is generally considered the fastest pure-Dart database. Here's how Tailor compares to Hive (Intel M3):
    • On writes (200k Objects):
      • Tailor: 338 ms
      • Hive: 12485 ms
    • On Reads (200k Objects):
      • Tailor: 30 ms
      • Hive: 26 ms
    • On Deletes (200k Objects):
      • Tailor: 35 ms
      • Hive: 7081 ms
    • You can run these tests yourself from the [test folder in the repository][https://github.com/AKushWarrior/tailor/tree/master/test].
  • Tailor has strong AES-GCM encryption built in. Just use var db = TailorDB(file: fileHere, encryption: true, passkey: keyHere) and pass a key. You can generate a key using the genKey() method.
  • Tailor uses a LinkedHashMap structure internally, so insertion order is preserved.


Take a look at the example below and API reference to understand the basic usage. Tailor is essentially a persistent map, with Strings as the main data type. Keys are all String, and Values are String, List<String>, or Map<String,String>.

import 'package:tailor/tailor.dart';

void main() {
  var db = TailorDB(
      file: File(join(Directory.current.path, 'example', 'db.json')),
      encryption: true,
      passkey: '6hUzyvUiXsf652tPHXLW2K-Fx6ZHEU_r');
  db.add(key: 'String', value: 'value');
  db.add(key: 'List', value: ['here', 'are', 'values']);
  db.add(key: 'Map', value: {'key1': 'value1', 'key2': 'value2'});
  print(Map.fromIterables(db.keys, db.values));

// Check out the persistent storage in the db.json file in the example folder!

// There's a lot more methods than these. Removing, getting, and tons of utilities/checks 
// are also available. Take a look at the API reference!

Normal and Flutter Usage

  • In the constructor, you may notice a file parameter. This is because Tailor requires a JSON file to write to.
  • Normally, you can just specify the path to where the db should be (File('pathtodb/db.json')). If that is inconvenient you can create it in the current directory (File(join(Directory.current.path, 'db.json')).
  • In Flutter, you will need the [path provider][https://pub.dev/packages/path_provider#-readme-tab-] library. Use it to get a library directory (var dir = await getLibraryDirectory()). Then, create a JSON file there (File(join(dir.path, 'db.json')).
  • Note: the above uses methods from the dart:io, path, and path provider libraries. Dart:io and path are bundled with this library; you don't need to import them separately. If you need to import only the core library (and not dart:io/path), use import 'package:tailor/tailor.dart' show TailorDB.


Please file feature requests and bugs at the issue tracker.