dio-http-cache icon indicating copy to clipboard operation
dio-http-cache copied to clipboard

can I use dio http cache with provider?

Open usernamekk opened this issue 4 years ago • 2 comments

`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();`

usernamekk avatar Aug 25 '20 12:08 usernamekk

Does that work?

ghenry avatar Sep 17 '20 13:09 ghenry

Does that work?

it should be work, i'm using Provider and ProxyProvider

pishguy avatar Sep 24 '20 14:09 pishguy