Last updated:
0 purchases
rxcache network image
Features #
Cache Image in disk
Cache Image in memory
Preload image in RxCacheManager
Getting started #
rxcache_network_image: 1.0.7
copied to clipboard
Issue #
หากใช้งานแล้วติดปัญหาสามารถเข้ามาสอบถามได้ที่เพจเฟส ได้เลยนะครับ
Facebook Page
Usage #
RxImage.cacheNetwork(
url: urls[index],
);
///set memory cache
cacheManager.setMemoryCache(size)
///download image
cacheManager.download()
///get file cache
cacheManager.getFile()
copied to clipboard
Create Custom CacheManager #
class CustomCacheManager extends BaseRxCacheManager {
static CustomCacheManager? _instance;
CustomCacheManager._({String folder = "rx_image_cache"}) : super(folder: folder);
factory CustomCacheManager({String folder = "rx_image_cache"}) {
_instance ??= CustomCacheManager._(folder: folder);
return _instance!;
}
}
copied to clipboard
Example #
class _MyHomePageState extends State<MyHomePage> {
final cacheManager = RxCacheManager();
@override
void initState() {
///preload and cache disk
for (final url in urls) {
cacheManager.download(url: url).then((value) => null);
}
super.initState();
}
@override
void didChangeDependencies() {
super.didChangeDependencies();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: Text(widget.title),
),
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Expanded(
child: ListView.builder(
itemCount: urls.length,
itemBuilder: (context, index) {
return RxImage.cacheNetwork(
url: urls[index],
);
},
))
],
),
);
}
}
copied to clipboard
Preview #
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.