Flutter: Send JSON body with dio package get request

Viewed 2309

this API is working normal in postman however in flutter app its returning this

{"success": true, "rslt": []}

where "rslt" is empty.

here's my code

dynamic getData(dynamic token) {
dio.options.headers['Authorization'] = '$token';
return await dio.get<dynamic>('https://address',
    queryParameters: <String,dynamic>{'cn': 'iPhone_11', 'qt': '20', 'ct': 'Delhi'});
}

What am I doing wrong in this code?

1 Answers

In postman, you have added body to GET request. Normally GET request should not have body. But there is no body in your request in Flutter.

Related