I am sending a request which is erroring with dio library
When catching the error, I can print(e.response);
and print(e.response.statusCode);
The runtimeType of the response is Response<dynamic>
And when printing the response I get something like this
{"message":"there is message from the api here"}
I cannot access this message to print it.
I tried
e.response.message and get
errors.dart:167 Uncaught (in promise) Error: NoSuchMethodError: 'message'
e.response["message"]
and get Uncaught (in promise) Error: NoSuchMethodError: '[]'
I tried json.encoding the e.response, and it doesn't work either, how can I access the data inside the type Response<dynamic>
Thank you
Use e.response.data['...']
instead in order to access the data you want,