1- ## json_cache
1+ # json_cache
22
33<center >
44 <img width =" 406 " hight =" 192 " alt =" json cache logo " src =" https://user-images.githubusercontent.com/24878574/119276278-56ef4a80-bbf0-11eb-8701-53a94f24f75b.png " align =" middle " >
55</center >
66
7- [ ![ EO principles respected here] ( https://www.elegantobjects.org/badge.svg )] ( https://www.elegantobjects.org )
8- [ ![ DevOps By Rultor.com] ( https://www.rultor.com/b/dartoos-dev/json_cache )] ( https://www.rultor.com/p/dartoos-dev/json_cache )
7+ [ ![ EO principles respected
8+ here] ( https://www.elegantobjects.org/badge.svg )] ( https://www.elegantobjects.org )
9+ [ ![ DevOps By
10+ Rultor.com] ( https://www.rultor.com/b/dartoos-dev/json_cache )] ( https://www.rultor.com/p/dartoos-dev/json_cache )
911
1012[ ![ pub] ( https://img.shields.io/pub/v/json_cache )] ( https://pub.dev/packages/json_cache )
1113[ ![ license] ( https://img.shields.io/badge/license-mit-green.svg )] ( https://github.com/dartoos-dev/json_cache/blob/master/LICENSE )
12- [ ![ style: lint] ( https://img.shields.io/badge/style-lint-4BC0F5.svg )] ( https://pub.dev/packages/lint )
1314[ ![ PDD status] ( https://www.0pdd.com/svg?name=dartoos-dev/json_cache )] ( https://www.0pdd.com/p?name=dartoos-dev/json_cache )
15+
1416[ ![ build] ( https://github.com/dartoos-dev/json_cache/actions/workflows/build.yml/badge.svg )] ( https://github.com/dartoos-dev/json_cache/actions/ )
15- [ ![ codecov] ( https://codecov.io/gh/dartoos-dev/json_cache/branch/master/graph/badge.svg?token=7T5VNQIIMZ )] ( https://codecov.io/gh/dartoos-dev/json_cache )
16- [ ![ Hits-of-Code] ( https://hitsofcode.com/github/dartoos-dev/json_cache )] ( https://hitsofcode.com/github/dartoos-dev/json_cache/view )
17+ [ ![ codecov] ( https://codecov.io/gh/dartoos-dev/json_cache/branch/master/graph/badge.svg?token=W6spF0S796 )] ( https://codecov.io/gh/dartoos-dev/json_cache )
18+ [ ![ CodeFactor Grade] ( https://img.shields.io/codefactor/grade/github/rafamizes/json_cache )] ( https://www.codefactor.io/repository/github/rafamizes/json_cache )
19+ [ ![ style: lint] ( https://img.shields.io/badge/style-lint-4BC0F5.svg )] ( https://pub.dev/packages/lint )
20+ [ ![ Hits-of-Code] ( https://hitsofcode.com/github/dartoos-dev/json_cache?branch=master )] ( https://hitsofcode.com/github/dartoos-dev/json_cache/view?branch=master )
21+
22+ ## Contents
23+
24+ - [ Overview] ( #overview )
25+ - [ Getting Started] ( #getting-started )
26+ - [ Demo application] ( #demo-application )
27+ - [ References] ( #references )
28+
29+ ## Overview
1730
1831** Json Cache** is an object-oriented package to serve as a layer on top of local
19- storage packages - packages that persist data locally on the user's device
20- -, unifying them as an elegant cache API.
32+ storage packages, unifying them as an elegant caching API.
2133
22- In addition, this package gives the programmer great flexibility; it provides a
23- set of classes that can be selected and combined in various ways to address
24- specific caching requirements.
34+ In addition, this package gives developers great flexibility by providing a set
35+ of classes that can be selected and combined in various ways to meet specific
36+ requirements.
2537
2638** Why Json?**
2739
2840- Because most of the local storage packages available for Flutter applications
2941 use json as the data format.
3042- There is an one-to-one relationship between the Dart's built-in type
31- ``` Map<String, dynamic> `` ` and json, which makes json encoding/decoding a
43+ ` Map<String, dynamic> ` and json, which makes json encoding/decoding a
3244 trivial task.
3345
3446## Getting Started
3547
36- ``` JsonCache ``` - the core interface of this package - represents the concept of
48+ ` JsonCache ` is the core interface of this package and represents the concept of
3749cached data. It is defined as:
3850
3951``` dart
@@ -53,9 +65,9 @@ abstract class JsonCache {
5365}
5466```
5567
56- It's reasonable to consider each cache entry (pair of key/data) as a group of
57- related data. Thus, it is expected to cache user data in groups, in which a key
58- represents the name of a single group of data. Example :
68+ It is reasonable to consider each cache entry (a key/data pair ) as a group of
69+ related data. Thus, it is expected to cache user data into groups where a key
70+ represents the name of a single data group. For example :
5971
6072``` dart
6173'profile': {'name': 'John Doe', 'email': '[email protected] ', 'accountType': 'premium'}; @@ -66,3 +78,21 @@ Above the _'profile'_ key is associated with the group of profile related data;
6678_ 'preferences'_ , with preferences data.
6779
6880<!-- @todo #10 Some implementation is needed to add more examples -->
81+
82+ ## Demo application
83+
84+ The demo application provides a fully working example, focused on demonstrating
85+ the caching API in action. You can take the code in this demo and experiment
86+ with it.
87+
88+ To run the demo application:
89+
90+ ``` shell
91+ git clone https://github.com/dartoos-dev/json_cache.git
92+ cd json_cache/example/
93+ flutter run -d chrome
94+ ```
95+
96+ This should launch the demo application on Chrome in debug mode.
97+
98+ ## References
0 commit comments