keeper 0.0.1 icon indicating copy to clipboard operation
keeper: ^0.0.1 copied to clipboard

Simple and flexible state storage mediator for Flutter applications.

Keeper #

Keeper simplifies storage of state. Just point where it should be saved, and keeper takes care of the rest. You don't need to write code to load, save, and convert data, keeper takes care of that for you.

๐Ÿ“œ Features #

  • โœ… Sync storage
  • ๐Ÿšง Async storage*
    • โœ… Store single async value
    • โŒ Store value in sync key
  • โŒ MobX store support
  • โŒ Function types
  • โŒ Observe storage changes
  • โœ… Extensible for many storage containers

Supported storage containers:

  • โœ… In-memory storage
  • โœ… Hive storage (through keeper_hive)

* supports one async annotation per field, sync annotation not supported for asynchronous field

โœ… Available | ๐Ÿšง Under development | โŒ Unsupported

๐Ÿ› ๏ธ Getting started #

Keeper relies on code generation to save you the trouble of writing storage code. The code is generated by keeper_codegen which requires build_runner.

โš ๏ธ This is an experimental project. Use with caution.

๐Ÿ’ป Usage #

In pubspec.yaml:

dependencies:
  keeper: ^0.0.1

dev_dependencies:
  build_runner: ^2.1.5 # check for recent version on pub.dev
  keeper_codegen: ^0.0.1 # check for recent version on pub.dev

In your Dart file import keeper:

import 'package:keeper/keeper.dart';

Set up the storage key:

KeepKey counterValue() => MemoryKeep().key('counter_value');

And set up the class:

part 'counter.g.dart';

class Counter = _Counter with _$CounterKeeper;

@kept
class _Counter {
  @At(counterValue)
  int value = 0;

  void increment() {
    value++;
  }
}

When the value changes it will now be automatically stored.

Different storage mechanisms may require different initialization.

โ„น๏ธ Additional information #

Contributions and bug reports are welcomed! Please include relevant information to help solve the bugs.

This project is licensed under The MIT License (MIT) available at LICENSE.

1
likes
130
pub points
0%
popularity

Publisher

verified publisher iconandrebaltazar.com

Simple and flexible state storage mediator for Flutter applications.

Repository (GitHub)

Documentation

API reference

License

Icon for licenses.MIT (LICENSE)

More

Packages that depend on keeper