运行时访问数据类型响应<dynamic>:Dio 错误

Access data in runtimeType Response<dynamic> : Dio error

我发送的请求与 dio 库有关

捕获错误时,我可以print(e.response);print(e.response.statusCode);

响应的runtimeType是Response<dynamic>

打印响应时我得到类似这样的东西

{"message":"there is message from the api here"}

我无法访问此消息来打印它。

我试过了

e.response.message and get errors.dart:167 Uncaught (in promise) Error: NoSuchMethodError: 'message'

e.response["message"] 得到 Uncaught (in promise) Error: NoSuchMethodError: '[]'

我试了json.encoding和e.response,也没用,我怎么访问Response<dynamic>

类型里面的数据

谢谢

请改用 e.response.data['...'] 以访问您想要的数据,