Flutter 颤振斩波器库缓存http响应

Flutter 颤振斩波器库缓存http响应,flutter,chopper,Flutter,Chopper,在我的移动应用程序中,我使用的是httplibrary,我想用这个库缓存http响应,我的服务器返回这个带有响应的标题: <-- 200 http://www.www.www/api/v1/dashboard/allData content-type: application/json cache-control: max-age=600, private transfer-encoding: chunked date: Mon, 07 Sep 2020 05:47:00 GMT serv

在我的移动应用程序中,我使用的是
http
library,我想用这个库缓存http响应,我的服务器返回这个带有响应的标题:

<-- 200 http://www.www.www/api/v1/dashboard/allData
content-type: application/json
cache-control: max-age=600, private
transfer-encoding: chunked
date: Mon, 07 Sep 2020 05:47:00 GMT
server: Apache

现在我希望缓存对我的应用程序正常工作,这个解决方案是正确的?

测试时发生了什么?@nvoigt我的应用程序总是尝试从服务器获取数据,我希望在禁用internet连接后,应该从缓存获取数据,但它不起作用。缓存使用什么?看起来Chopper没有缓存机制,我在文档中找不到任何缓存机制。@我对缓存机制没有任何经验,也没有实现缓存机制。在这种情况下,没有缓存,您的应用程序需要internet连接才能发出请求。
final client = ChopperClient(

client: http.IOClient(
  HttpClient()..connectionTimeout = const Duration(seconds: 60),
),
baseUrl: webUri,
services: [
  _$WebApi(),
],
converter: const JsonConverter(),
interceptors: [
  const HeadersInterceptor({'Content-Type': 'application/json','Cache-Control':'private, max-age=600'}),
  HttpLoggingInterceptor(),
]);