orange 1.2.10 copy "orange: ^1.2.10" to clipboard
orange: ^1.2.10 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!');
}
20
likes
140
points
518
downloads

Publisher

verified publisherjunelee.fun

Weekly Downloads

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