hurshi / dio-http-cache

http cache lib for Flutter dio like RxCache
Apache License 2.0
274 stars 223 forks source link

cacheManager.clearAll() not working #62

Closed pishguy closed 3 years ago

pishguy commented 4 years ago

clearing cache in this code doesn't work

static RestApi create() {
  final BaseOptions options = BaseOptions(
    connectTimeout: 5000,
    receiveTimeout: 6000,
    headers: {'Content-Type': 'application/json; charset=UTF-8'},
  );
  final cacheManager = DioCacheManager(CacheConfig(baseUrl: baseApiUrl));
  cacheManager.clearAll();
  final dio = Dio(options)
    ..interceptors.addAll([
      cacheManager.interceptor as Interceptor,
      LogInterceptor(responseBody: true)
    ]);
  return _RestApi(dio);
}
hurshi commented 3 years ago

Hello, thanks for your feedback;

cacheManager.clearAll is a async method

Please try:

await cacheManager.clearAll();
osamamohammed98 commented 3 years ago

not work with me

osamamohammed98 commented 3 years ago

image

osamamohammed98 commented 3 years ago

after i close the app and open again it work