https://github.com/nuelsoft/http_get_cache
A HTTP Get package that caches request and returns them when request fails
https://github.com/nuelsoft/http_get_cache
cache flutter http-cache
Last synced: 1 day ago
JSON representation
A HTTP Get package that caches request and returns them when request fails
- Host: GitHub
- URL: https://github.com/nuelsoft/http_get_cache
- Owner: nuelsoft
- License: mit
- Created: 2021-07-16T13:25:29.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-07-20T13:16:32.000Z (over 4 years ago)
- Last Synced: 2025-11-27T17:11:28.483Z (3 months ago)
- Topics: cache, flutter, http-cache
- Language: Dart
- Homepage:
- Size: 9.77 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# 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
```console
http_get_cache:
```
## Usage
First, **Initialize** GetCache.
```dart
GetCache.initialize();
```
`blackList` is an optional param that lists the url paths you want to exclude in your cache
```dart
GetCach.initialize(blackList: ["/v1/current"]);
```
You can then go ahead and use this as your http getter.
```dart
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.