Describe the bug
When trying to read from a named cache, the stash_dio_interceptor crashes when using stash_hive.
As an aside, maybe stash_dio could use a default name (or require a name) for the cache rather than generating a new one each time. Presumably one uses persistent storage like Hive to be able to reuse it between runs no? :)
To Reproduce
Make a request to any URL that responds with headers that allow caching while using stash_dio with a named stash_hive cache
Restart
Make a request to the same URL again.
Expected behavior
The cached response should be returned
Actual behavior
There is a crash:
E/flutter (13275): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: type '_InternalLinkedHashMap<dynamic, dynamic>' is not a subtype of type 'Map<String, dynamic>'
E/flutter (13275): #0 CacheInterceptorBuilder._onRequest (package:stash_dio/src/dio/interceptor_builder.dart:134:67)
E/flutter (13275): <asynchronous suspension>
Version
dio: 4.0.0
stash: 3.0.0
stash_dio: 3.0.0
stash_hive: 3.0.0
Additional context
This seems related to https://github.com/ivoleitao/stash/issues/9 but I didn't hit this before because I wasn't using a named cache and as such, a new one was created on each run.
Describe the bug When trying to read from a named cache, the stash_dio_interceptor crashes when using stash_hive.
As an aside, maybe stash_dio could use a default name (or require a name) for the cache rather than generating a new one each time. Presumably one uses persistent storage like Hive to be able to reuse it between runs no? :)
To Reproduce
Expected behavior The cached response should be returned
Actual behavior There is a crash:
Version dio: 4.0.0 stash: 3.0.0 stash_dio: 3.0.0 stash_hive: 3.0.0
Additional context This seems related to https://github.com/ivoleitao/stash/issues/9 but I didn't hit this before because I wasn't using a named cache and as such, a new one was created on each run.