hurshi / dio-http-cache

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

Unhandled Exception: type 'Null' is not a subtype of type 'String' in type cast #125

Open jerlai15 opened 1 year ago

jerlai15 commented 1 year ago

Hi,

The API that is caching has a null value and cached is not accepting it:

E/flutter ( 5080): [ERROR:flutter/lib/ui/ui_dartstate.cc(198)] Unhandled Exception: type 'Null' is not a subtype of type 'String' in type cast E/flutter ( 5080): #0 $CacheObjFromJson (package:dio_http_cache/src/core/obj.g.dart:11:17) E/flutter ( 5080): #1 new CacheObj.fromJson (package:dio_http_cache/src/core/obj.dart:43:7) E/flutter ( 5080): #2 DiskCacheStore.getCacheObj (package:dio_http_cache/src/store/store_disk.dart:118:44) E/flutter ( 5080): E/flutter ( 5080): #3 CacheManager._pullFromCache (package:dio_http_cache/src/core/manager.dart:32:13) E/flutter ( 5080): E/flutter ( 5080): #4 CacheManager.pullFromCacheBeforeMaxAge (package:dio_http_cache/src/core/manager.dart:56:15) E/flutter ( 5080): E/flutter ( 5080): #5 DioCacheManager._onRequest (package:dio_http_cache/src/manager_dio.dart:48:33) E/flutter ( 5080): E/flutter ( 5080):

Do you have any work around on this?

TianyongWang commented 1 year ago

来信已收到

dhaq commented 1 year ago

@jerlai15 Did you find any solutions? I facing it when response json is large