keeper 0.0.1 copy "keeper: ^0.0.1" to clipboard
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
150
points
56
downloads

Publisher

verified publisherandrebaltazar.com

Weekly Downloads

Simple and flexible state storage mediator for Flutter applications.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

More

Packages that depend on keeper