ivoleitao / stash

Key-value store abstraction with plain and cache driven semantics and a pluggable backend architecture.
MIT License
87 stars 16 forks source link

stash_dio crash when reading from hive cache #9

Closed tjarvstrand closed 3 years ago

tjarvstrand commented 3 years ago

Describe the bug When trying to read from the cache, the stash_dio_interceptor crashes when using stash_hive. It does not seem to work at all.

To Reproduce Make two requests to seemingly any URL while using stash_dio with stash_hive

Expected behavior An HTTP-response is returned both times.

Actual behavior The second request crashes with:

E/flutter ( 2495): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: type '_InternalLinkedHashMap<String, dynamic>' is not a subtype of type 'CacheValue' in type cast
E/flutter ( 2495): #0      CacheInterceptorBuilder._onRequest (package:stash_dio/src/dio/interceptor_builder.dart:133:43)
E/flutter ( 2495): <asynchronous suspension>

Version dio: 4.0.0 stash: 2.0.2 stash_dio: 2.0.3 stash_hive: 2.0.3

ivoleitao commented 3 years ago

Let me try this with a cache that employs serialization

ivoleitao commented 3 years ago

Yap fixed, I will send out a new version shortly. Sorry about this mistakes but this is one of the less tested package on stash as I plan to use it but didn't had the opportunity to do so.

tjarvstrand commented 3 years ago

OK! If you're rolling out a new version, would you mind looking at this as well: https://github.com/ivoleitao/stash/pull/10 ?

ivoleitao commented 3 years ago

I've already merged it :-). I will push everything in the new version

tjarvstrand commented 3 years ago

Thanks! :)

ivoleitao commented 3 years ago

Published