Skip to content

Commit 70ee530

Browse files
solid-yuriiprykhodkoIllia Romanenko
andauthored
Update README, update changelog for version 2.1.0 (#28)
* Add readme section on custom key-value stores * Bump to 2.1.0, update CHANGELOG.md * Update README.md Co-authored-by: Illia Romanenko <[email protected]> * Use consistent naming in README Co-authored-by: Illia Romanenko <[email protected]>
1 parent b31e6df commit 70ee530

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 2.1.0
2+
3+
- Add support for a generic `KeyValueStore` interface.
4+
- Add an extensive unit-test suite.
5+
16
## 2.0.1
27

38
- Restore `BehaviorSubject` behavior of `HydratedSubject`.

README.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,33 @@ We also support serialized classes with `hydrate` and `persist` arguments.
5252
```dart
5353
final user$ = HydratedSubject<User>(
5454
"user",
55-
hydrate: (String s) => User.fromJSON(s),
56-
persist: (User user) => user.toJSON(),
55+
hydrate: (String s) => User.fromJson(s),
56+
persist: (User user) => user.toJson(),
5757
);
5858
```
5959

6060
## Reliable
6161

6262
Hydrated is mock tested with all supported types and is dogfooded by its creator.
6363

64+
## Extensible
65+
66+
Hydrated supports any key-value data storages -- just implement the `KeyValueStore` interface
67+
and you will be able to use *hive*, *flutter_secure_storage* or any other persistence solution of your choice.
68+
69+
```dart
70+
class MyAwesomeKeyValueStore implements KeyValueStore {
71+
/// your implementation here...
72+
}
73+
74+
final user = HydratedSubject<User>(
75+
"user",
76+
hydrate: (String s) => User.fromJson(s),
77+
persist: (User user) => user.toJson(),
78+
keyValueStore: MyAwesomeKeyValueStore()
79+
);
80+
```
81+
6482
## Demo
6583

6684
<img alt="demo of Hydrated BehaviorSubject between app restarts" src="https://raw.githubusercontent.com/lukepighetti/hydrated/master/doc/hydrated.gif" width="400">

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: hydrated
22
description: An automatically persisted BehaviorSubject with simple hydration for Flutter. Intended to be used with the BLoC pattern.
3-
version: 2.0.1
3+
version: 2.1.0
44
homepage: https://github.com/solid-software/hydrated
55

66
environment:

0 commit comments

Comments
 (0)