0
votes

I am using Client() from http.dart. I am able to post with parameter but I have no idea how to do get with parameter. Post has body that takes the parameter but get doesn't.

I have tried

This is my client

Client httpClient = Client();
var response = await httpClient.get("controller/action/{parameter here}"
2
Huh? do not understand. - OldProgrammer
Use Dio package to make HTTP requests. - George

2 Answers

1
votes

I hope this should solve your problem

fetchData() async {
Client httpClient = Client();
counter++;
var response =
    await httpClient.get('https://jsonplaceholder.typicode.com/photos/$counter');

print(response.body);

}
0
votes

i think you are saying that you want any kind of data to be sent to the server with GET request too, you can not do it simply, may be your parameter are the header of the Get , try passing your parameters in the header of GET