Skip to content

A HTTP Get package that caches request and returns them when request fails

License

Notifications You must be signed in to change notification settings

nuelsoft/http_get_cache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HTTP Get Cache

A cache wrapper for http GET requests This helps you achieve an "offline mode" for your flutter application.

Installation

In your pubspec.yaml add to your dependencies

http_get_cache: <current_version>

Usage

First, Initialize GetCache.

GetCache.initialize();

blackList is an optional param that lists the url paths you want to exclude in your cache

GetCach.initialize(blackList: ["/v1/current"]);

You can then go ahead and use this as your http getter.

Uri uri = Uri.https("url.com", query: {"name": "my_name"});
Response response = await GetCache.instance.get(uri, headers: {"token": "my_token"})

What Happens

When the underlying get request fails, GetCache then returns a cached response for the corresponding request path.

About

A HTTP Get package that caches request and returns them when request fails

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages