刚入手code flutter,参考网上代码封装了dio,搭建了一个网络框架,但是在解析数据时总是报错 type 'String' is not a subtype of type 'int' of 'index',网上找了很久,唯一一篇相关的需要付费才能看,所以只能自己找找问题了。
请求的数据,拷贝出来粘贴到文本文件中,显示如下:
{"errCode":0,"errMsg":"","data":{"auditVersion":"1.1.2","neteaseAccid":"fa5d1eb9","uid":113522,"bankReqSignKey":"3w8Qc!w!","deactivating":false,"accessToken":"18l7SZOy3z6y2z8XxOKXms6eUkcbVmEKj5gtdh+eooObD6c2CO8g4duP14pzwsg+DgW6oD/lWwZxlup/e8HsPbfhVFHmBiigDEitpsRdFe1i16JGEH+IN8VXMAM0dMRq","neteaseToken":"b7046fb8fa01c5c8975fdb63a2138541"}}
看起来是正常json数据,并无异常,也不存在网上的所说的观点,数据类型错误。
公共解析拦截器代码如下:
import 'package:dio/dio.dart'; import 'result_data.dart'; class ResponseInterceptors extends InterceptorsWrapper { @