I'm using using Dio 3.0.9, I'm trying to get with parameters, it's returning a 404 error, in Insomnia/Postman it works perfectly ... What is wrong with the code?
Response response = await Dio(
BaseOptions(headers: <String, String>{'authorization': AUTH}))
.get($url, queryParameters: {
"category": {"id": 1}});
note: when using a url without parameters it works, but when it has parameters it doesn't ...
See Dio doesnt supports passing JSON data through it when we are using GET request. So One option to solve your problem is use http package or do this
Go to Dio.dart and make this small change
if (data != null &&
["POST", "PUT", "PATCH", "DELETE"].contains(options.method)) {
here remove the whole other part that is if (data != null ) {
make it like this.
I have searched about it if you still face difficulty you can go here github.com/flutterchina/dio/issues/252
Hope This would help you : )