Flutter shareable package of object-oriented classes for local caching of user data in json

Overview

json_cache

json cache logo

EO principles respected here DevOps By Rultor.com

pub license style: lint PDD status build codecov Hits-of-Code

Json Cache is an object-oriented package to serve as a layer on top of local storage packages - packages that persist data locally on the user's device -, unifying them as an elegant cache API.

In addition, this package gives the programmer great flexibility; it provides a set of classes that can be selected and combined in various ways to address specific caching requirements.

Why Json?

  • Because most of the local storage packages available for Flutter applications use json as the data format.
  • There is an one-to-one relationship between the Dart's built-in type Map<String, dynamic> and json, which makes json encoding/decoding a trivial task.

Getting Started

JsonCache - the core interface of this package - represents the concept of cached data. It is defined as:

/// Represents a cached json data.
abstract class JsonCache {
  /// Frees up cache storage space.
  Future<void> clear();

  /// Refreshes some cached data by its associated key.
  Future<void> refresh(String key, Map<String, dynamic> data);

  /// Erases [key] and returns its associated data.
  Future<Map<String, dynamic>?> erase(String key);

  /// Recovers some cached data; null if a cache miss occurs - no [key] found.
  Future<Map<String, dynamic>?> recover(String key);
}

It's reasonable to consider each cache entry (pair of key/data) as a group of related data. Thus, it is expected to cache user data in groups, in which a key represents the name of a single group of data. Example:

'profile': {'name': 'John Doe', 'email': '[email protected]', 'accountType': 'premium'};
'preferences': {'theme': {'dark': true}, 'notifications':{'enabled': true}}

Above the 'profile' key is associated with the group of profile related data; 'preferences', with preferences data.

Issues
Releases(1.0.0)
  • 1.0.0(Jan 8, 2022)

    See #57, release log:

    • b4ab9a78d68e5658b3239a14df5d51e2d1c44378 by @rafamizes: test: add test case for L2 hit...
    • c8022e1a91516398080451cdddab10642e0a35c4 by @rafamizes: doc(README): add link to the J...
    • 7685da2d93864acb47e141af09cc2963d22334ce by @rafamizes: doc(CHANGELOG): changes of the...
    • 45416b51155fcc5e81ee8a633160246f3409af25 by @rafamizes: doc: improvements to the READM...
    • 8677785e2411b47cfc5dd7f9a58ca973d711f025 by @rafamizes: style: stricter linting rules ...
    • c1318035eede3be99c159ebac682538997a5e37f by @rafamizes: build: bump up dependencies (#...

    Released by Rultor 1.70.6, see build log

    Source code(tar.gz)
    Source code(zip)
  • 0.3.4(Aug 26, 2021)

    See #47, release log:

    • a3b4a2c7e18f5aba223838e572906119713f9a51 by @rultor: version 0.3.4
    • 06c23647fc86bf5daa4ebf8d86a48c15f93c19ce by @rafamizes: Update CHANGELOG.md
    • 0b01aad21ed7a6af0ac4e56a8bef5ef21b0d34b8 by @rafamizes: doc(README): much better packa...
    • dcd4dff29bca1621b60b6662e59690ab8d669ccd by @rafamizes: Update README.md

    Released by Rultor 1.70.1, see build log

    Source code(tar.gz)
    Source code(zip)
  • 0.3.3(Aug 26, 2021)

    See #46, release log:

    • 05851ccc703b55a4c87d8bc323feacf3fc9af3f1 by @rultor: version 0.3.3
    • 55930954f220c4798b89f34f6c60e9f74ad2091a by @rafamizes: feat: create JsonCacheEncPrefs...

    Released by Rultor 1.70.1, see build log

    Source code(tar.gz)
    Source code(zip)
  • 0.3.2(Aug 25, 2021)

    See #44, release log:

    • b7b7dd4015f8f00d3ee8ed1161fa10ddbf05919f by @rultor: version 0.3.2
    • 12d366a8636115796b08ab35a2d316ade8c08b29 by @rafamizes: Update README.md
    • 8e8909ffd3e94603a7776337a9f53f614bdb692f by @rafamizes: refact: remove 'late' modifier...
    • aef40105adc8e65b4f9120c93c31e18f26177fc3 by @rafamizes: Update README.md

    Released by Rultor 1.70.1, see build log

    Source code(tar.gz)
    Source code(zip)
  • 0.3.1(Aug 25, 2021)

    See #42, release log:

    • 61569ace4eeb120281a5b283dcef318d90fa630b by @rultor: version 0.3.1
    • bc4590616e4fbfa8d6ec804355fa03dcdd1545e7 by @rafamizes: doc(README): fix formatting an...
    • a3b0737da76f30bfebee84a3ffe3aa1319651238 by @rafamizes: Update README.md
    • 7445f5b5ee806517779edbea6ac30eb0014d3b4b by @rafamizes: Update README.md
    • 6d43a7635c09d493ef9f9c1c19b3a4dfa0c86fa2 by @rafamizes: Update README.md
    • 3cb00283588827eca2d16617ff9e4f71af7f52d2 by @rafamizes: feat: JsonCacheCrossLocalStora...
    • 326f2385ccd2e6508734cbc4199c2bbdb818414a by @rafamizes: style: pub dev fixes * refacto...

    Released by Rultor 1.70.1, see build log

    Source code(tar.gz)
    Source code(zip)
  • 0.3.0(Aug 24, 2021)

    See #37, release log:

    • 2cef1ddfae7ead0296c4535299b8a0931c95802b by @rultor: version 0.3.0
    • b896a41923efeb4ddf451f1562867b1f0e5f857a by @rafamizes: refactor!: restore JsonCacheMe...
    • 5351002a06aaf212c5e8e291bd2ad124da0a27fd by @rafamizes: refactor! rename JsonCacheMem....
    • 1f91e763fdfb4b685974f2978adc8c2b952be872 by @rafamizes: Update README.md
    • 9410fad1904c4a1b9f6c1f12f185eb8b5c586230 by @rafamizes: Update README.md
    • f7ea4fa58657c6e680bc121c7190ed618d020743 by @rafamizes: Update README.md
    • f7e67114ed027dc6fb9a9a1d5e9ee7842f0b55d1 by @rafamizes: Update README.md
    • 8b3f21857e2e1c49e21ed0ed9a514f2dfff52cea by @rafamizes: Update README.md

    Released by Rultor 1.70.1, see build log

    Source code(tar.gz)
    Source code(zip)
  • 0.2.1(Aug 23, 2021)

    See #34, release log:

    • 947f0a6d46157494b50fcb2b505af2b04e4fd35b by @rultor: version 0.2.1
    • 14f2529a9dabd19a8849d1aa45531e8ebf6f4d58 by @rafamizes: Update README.md
    • 2d757cc3a26d5a00f3cc89dbe205ebadbecfee5d by @rafamizes: feat: JsoCacheLocalStorage Clo...

    Released by Rultor 1.69.1, see build log

    Source code(tar.gz)
    Source code(zip)
  • 0.2.0(Aug 22, 2021)

    See #28, release log:

    • 811fd844c40be6962b7c6e01656a575393c8e1a7 by @rultor: version 0.2.0
    • 8bbf7ff3ec74202469d950b01520ce3a487741ff by @rafamizes: feat: JsonCachePrefs class Clo...

    Released by Rultor 1.69.1, see build log

    Source code(tar.gz)
    Source code(zip)
  • 0.1.0(Aug 21, 2021)

    See #25, release log:

    • cf9777825c028ea3438cc44b5c154b6fa221405b by @rultor: version 0.1.0
    • 0cddc6e66a9e2f182fb4163e020e11557bbdc130 by @rafamizes: Update CHANGELOG.md
    • cc95ff6dc62ca74e68b0f273527a71e24386bfeb by @rafamizes: built: update lint version to ...
    • a3e8247991c0abf76faeaa41515897e05a111c97 by @rafamizes: Update README.md
    • f6eca7cb746d4484e5009d1d186cecb07d63c9de by @rafamizes: Update README.md
    • b515e01a5ce89aa64d6021c097d351d9ede4f2ae by @rafamizes: Update README.md
    • 870ddc46883c3f236952c1ea6593ea4ec66ef103 by @rafamizes: test: JsonCacheWrap, JsonCache...
    • 5730204f6a16e1328fd628fca8977992f67a66f7 by @rafamizes: fix more grammar mistakes
    • b4db1e479629360c25fa7b116938c23e5b25b6d9 by @rafamizes: fix grammar errors
    • f5e0535282d3901b06b92156b9b5d11337b3d5c7 by @rafamizes: Update README.md
    • b8b9593acbe652ad551bad43897f504df2362757 by @rafamizes: Update README.md
    • dbba968f1a75b267dcd5e9db94e785a7d9dedc62 by @rafamizes: feat: JsonCache interface and ...
    • d1d22f1c9048394d539a381380bbc18878bc4e23 by @rafamizes: build(rultor): disable squashi...
    • 7907fd43cbd1e9b1018861709e9f525656d472d1 by @rultor: build: structural configuratio...
    • 00959bc149c06e335bc1349e2a9676824fbff283 by @rafamizes: chore: remove annoying issue t...
    • 84ccc66097d0686a2e503a8a0fa12916faffcc43 by @rafamizes: doc(README): enhance the conte...
    • 6bef1d693ce6f7678b4b59b109a5dfdd645d2e02 by @rultor: doc(README): improve the packa...
    • cf9f37fcfd355d90178fcc214647aebc2abf1f33 by @rafamizes: doc(README): add the project's...
    • 77b4c8ffdfb83adb2e451215e53bccd953cc48c7 by @rafamizes: doc(README): insert badges #8 ...
    • 0678745e41ba730fd6acf786b694638c25c2444a by @rafamizes: doc: fix the project name in i...
    • and 4 more...

    Released by Rultor 1.69.1, see build log

    Source code(tar.gz)
    Source code(zip)
Owner
Dartoos
Web and mobile software company
Dartoos
A flutter search engine based on MediaWiki with caching.

Table of contents Project Description Working App Architecture BLoC/Cubit Pattern Caching using HiveDB App UI Project Setup To-Do How to get started w

Shashwat Joshi 37 Nov 16, 2021
Create a Flutter User Profile Page UI where you can access and edit your user's information within your Flutter app.

Flutter Tutorial - User Profile Page UI 1/2 Create a Flutter User Profile Page UI where you can access and edit your user's information within your Fl

Johannes Milke 24 Jan 19, 2022
Create a Flutter User Profile Page UI where you can access and edit your user's information within your Flutter app.

Flutter Tutorial - User Profile Page UI #2 Create a Flutter User Profile Page UI where you can access and edit your user's information within your Flu

Johannes Milke 15 Dec 20, 2021
Let's create a complete Flutter User Profile Page with SharedPreferences to persist the user's information in Flutter.

Flutter Tutorial - User Profile & SharedPreferences Let's create a complete Flutter User Profile Page with SharedPreferences to persist the user's inf

Johannes Milke 12 Jan 11, 2022
Dart / Flutter package that allows discovering network devices in local network (LAN).

lan_scanner Dart / Flutter package that allows discovering network devices in local network (LAN). Note: This library is intended to be used on Class

null 5 Dec 27, 2021
Codeflow 18 Dec 8, 2021
COVID-19 application made with Flutter, following Test Driven Development (TDD) and Clean Architecture along with Internationalization with JSON.

Covid App COVID-19 application made with Flutter, following Test Driven Development (TDD) and Clean Architecture along with Internationalization with

Sandip Pramanik 3 May 24, 2021
Displaying json models in a Flutter widget

Displaying json models in a Flutter widget ?? Cool solution for viewing models in debug working Getting Started Add dependency dependencies: flutter

Stanislav Ilin 28 Jan 8, 2022
Sample Flutter Drawing App which allows the user to draw onto the canvas along with color picker and brush thickness slider.

DrawApp Sample Flutter Drawing App which allows the user to draw onto the canvas along with color picker and brush thickness slider. All code free to

Jake Gough 209 Jan 13, 2022
A collection of Animations that aims to improve the user experience for your next flutter project.

Flutter Animations A collection of Animations that aims to improve the user experience for your next flutter project. Built by Ezaldeen SAHB I hope th

Ezaldeen Sahb 116 Jan 7, 2022
Persist data with Flutter's Hive NoSQL Database locally on Android, iOS & Web.

Flutter Tutorial - Hive NoSQL Database Persist data with Flutter's Hive NoSQL Database locally on Android, iOS & Web. ✌  Preview App Preview Course Pr

Johannes Milke 34 Jan 7, 2022
The Flutter app demonstrates displaying data in a weekly format.

Flutter weekly chart The Flutter app demonstrates displaying data in a weekly format. I came across this kind of screen in the app that I have been wo

BenBoonya 17 Dec 21, 2021
A Flutter application with proper navigation and routes handling and API data fetching and posting.

Flutter-Navigation-and-API-Integration A Flutter application with proper navigation and routes handling and API data fetching and posting. ⏮ Preview G

Ehmad Saeed⚡ 7 Sep 18, 2021
AI Library to create efficient Artificial Neural Networks. Computation uses SIMD (Single Instruction Multiple Data) to improve performance.

eneural_net eNeural.net / Dart is an AI Library for efficient Artificial Neural Networks. The library is portable (native, JS/Web, Flutter) and the co

null 17 Dec 22, 2021
A set of real world timelines to showcase the use of timeline_tile package, built with Flutter.

beatiful_timelines Beautiful timelines built with Flutter and timeline_tile. Current examples: Timeline Showcase Football Timeline Activity Timeline S

null 188 Dec 21, 2021
A lightweight flutter package to linkify texts containing urls, emails and hashtags

linkfy_text A lightweight flutter package to linkify texts containing urls, emails and hashtags. Usage To use this package, add linkfy_text as a depen

Stanley Akpama 12 Jan 9, 2022
Fancy Containers Flutter Package

Fancy Containers Fancy container package lets you add a beautiful gradient container to your Flutter app. Installation Add the latest version of packa

Aditya Thakur 7 Dec 1, 2021
Flutter integration for Supabase. This package makes it simple for developers to build secure and scalable products.

supabase_flutter Flutter package for Supabase. What is Supabase Supabase is an open source Firebase alternative. We are a service to: listen to databa

Supabase 101 Jan 13, 2022