dio-http-cache
dio-http-cache copied to clipboard
can I use dio http cache with provider?
`Future<List<People>> getDataName() async {
DioCacheManager _dioCacheManager;
_dioCacheManager = DioCacheManager(CacheConfig());
Options _cacheOptions =
buildCacheOptions(Duration(days: 7), forceRefresh: true,);
Dio _dio = Dio();
_dio.interceptors.add(_dioCacheManager.interceptor);
Response response = await _dio.get(
'https://firebasestorage.googleapis.com/v0/b/sample-awka.appspot.com/o/people.json?alt=media',
options: _cacheOptions);
List<People> _persons =
(response.data as List).map((pr) {
print('$pr');
People prt = People.fromJson(pr);
}).toList();
return _persons;
}`
`Provider.of<People>(context).getDataName();`
Does that work?
Does that work?
it should be work, i'm using Provider
and ProxyProvider