orange 1.2.9+3 copy "orange: ^1.2.9+3" to clipboard
orange: ^1.2.9+3 copied to clipboard

orange database is super fast and esay modern key-value store. working everywhere.and no need build_runner

example/main.dart

import 'package:orange/orange.dart';
import 'package:code_timer/code_timer.dart';

main() async {
  await Orange.init();
  // write
  Orange.setInt('counter', 10);
  Orange.setBool('repeat', true);
  Orange.setDouble('decimal', 1.5);
  Orange.setString('action', 'Start');
  Orange.setList('list', ['a', 'b', 2]);
  Orange.setMap(
      'map', {'string': 'value', 'int': 1, 'double': 1.5, 'bool': true});

  // read
  print(Orange.getInt('counter'));
  print(Orange.getBool('repeat'));
  print(Orange.getDouble('decimal'));
  print(Orange.getString('action'));
  print(Orange.getList('list'));
  print(Orange.getMap('map'));

  // remove
  Orange.remove('int');

  // performance test(10000 time writes)
  CodeTimer.start();
  for (int i = 0; i < 10000; i++) {
    Orange.setInt('int$i', 1);
  }
  CodeTimer.stop(label: 'write performance test');

  // performance test(10000 time reads)
  CodeTimer.start();
  for (int i = 0; i < 10000; i++) {
    Orange.getInt('int$i');
  }
  CodeTimer.stop(label: 'read performance test');

  CodeTimer.start();
  await Orange.isSavedToDisk();
  CodeTimer.stop(label: 'all data saved to disk!');
}
17
likes
140
pub points
64%
popularity

Publisher

verified publisherjunelee.fun

orange database is super fast and esay modern key-value store. working everywhere.and no need build_runner

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

easy_event_bus, flutter, path, path_provider, sembast, sembast_web

More

Packages that depend on orange