orange 1.0.0 copy "orange: ^1.0.0" to clipboard
orange: ^1.0.0 copied to clipboard

fast and esay modern key-value store

example/main.dart

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

main() async {
  // write
  await Orange().setInt('counter', 10);
  await Orange().setBool('repeat', true);
  await Orange().setDouble('decimal', 1.5);
  await Orange().setString('action', 'Start');


  // read
  print(await Orange().getInt('counter'));
  print(await Orange().getBool('repeat'));
  print(await Orange().getDouble('decimal'));
  print(await Orange().getString('action'));

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

  // performance test(10000 time writes)
  CodeTimer.start();
  for(int i = 0; i < 10000; i++){
    await 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++){
    await Orange().getInt('int$i');
  }
  CodeTimer.stop(label: 'read performance test');
}
17
likes
0
pub points
64%
popularity

Publisher

verified publisherjunelee.fun

fast and esay modern key-value store

License

unknown (license)

Dependencies

easy_event_bus, flutter, path, path_provider, sembast, sembast_web

More

Packages that depend on orange