eGust / flutter_cache_store

More configurable cache manager for Flutter
BSD 3-Clause "New" or "Revised" License
19 stars 7 forks source link

In the case the fetch Method throws the CacheControlPolicy Fails #12

Open stefanpieck opened 4 years ago

stefanpieck commented 4 years ago

In the case the fetch Method throws, which seems the only way to implement a statusCode check, the CacheControlPolicy throws in cleanup.

Tried calling: >(1578663515)
#0      Object.noSuchMethod (dart:core-patch/object_patch.dart:53:5)
#1      CacheControlPolicy.cleanup.<anonymous closure> (package:flutter_cache_store/src/policies/cache_control_policy.dart:45:30)
#2      WhereIterator.moveNext (dart:_internal/iterable.dart:442:11)
#3      new List.from (dart:core-patch/array_patch.dart:47:19)
#4      Iterable.toList (dart:core/iterable.dart:400:5)
#5      CacheControlPolicy.cleanup (package:flutter_cache_store/src/policies/cache_control_policy.dart:48:8)
#6      CacheStore._cleanup.<anonymous closure> (package:flutter_cache_store/src/cache_store.dart:206:49)
#7      BasicLock.synchronized (package:synchronized/src/basic_lock.dart:32:26)
#8      CacheStore._cleanup (package:flutter_cache_store/src/cache_store.dart:199:41)
#9      CacheStore._delayCleanUp.<anonymous closure> (package:flutter_cache_store/src/cache_store.dart:225:13)
#10     new Future.delayed.<anonymous closure> (dart:async/future.dart:316:39)
#11     _rootRun (dart:async/zone.dart:1122:38)

That seems to be the case because the timestamp in the cache item is not set.

eGust commented 4 years ago

looks like the same bug as #11 i will have a look later

eGust commented 4 years ago

sorry i could not reproduce your exception. however i rewrote cleanup logic. if the bug still exists, could you please implement it with the boilerplate: https://gist.github.com/eGust/b49acc3bbbc954d209182082c2ed7dd2