Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/calsranna/cached_network
A package use to fetch data from web and write as string into cache directory
https://github.com/calsranna/cached_network
Last synced: about 1 month ago
JSON representation
A package use to fetch data from web and write as string into cache directory
- Host: GitHub
- URL: https://github.com/calsranna/cached_network
- Owner: CalsRanna
- License: mit
- Created: 2022-10-18T15:22:56.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-01-04T11:40:52.000Z (about 1 year ago)
- Last Synced: 2024-10-14T09:28:23.972Z (3 months ago)
- Language: Dart
- Size: 32.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Cached Network
This is a package use to fetch data from web and write as string into cache directory. If the cache file exists, then will read data from cache file instead of web.
Besides, it provides a widget use to view caches.## Install
```bash
flutter pub add cached_network
```## Getting started
`CachedNetwork`
```dart
import 'package:cached_network/cached_network.dart';void main() async {
var network = CachedNetwork();
await network.request('https://google.com');
}
````CacheView`
```dart
import 'package:cached_network/cached_network.dart';
import 'package:flutter/material.dart';void main() {
runApp(const MaterialApp(
home: CacheViewDemo(),
));
}class CacheViewDemo extends StatelessWidget {
const CacheViewDemo({super.key});@override
Widget build(BuildContext context) {
return const CacheView();
}
}
```## Important
If you use CachedNetwork not in flutter or in isolate, you should specify the `cacheDirectory` when you construct the instance.