0

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. Commented Jun 5, 2019 at 17:13
  • 1
    Use Dio package to make HTTP requests. Commented Jun 5, 2019 at 17:14

2 Answers 2

1

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);

}
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you so much. The perfect solution to my problem
0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.