I want to implement all the type of HTTP request in a API using Flutter GetX state management.
I have managed to do the "get" request.
I want to implement all the type of HTTP request in a API using Flutter GetX state management.
CodePudding user response:
// Forpost
dataPost(){
final response = await Dio().post(
//your url
options: Options(
followRedirects: false,
validateStatus: (status) => true,
headers: {
//your header
},
),
data:{
//your body
});
}
//For Get
dataGet(){
final response = await Dio().get(
//your url,
options: Options(
followRedirects: false,
validateStatus: (status) => true,
headers: {
//your header
},),
queryParameters:{
//your queryParameters
});}
CodePudding user response:
you can refer this document by Getx , in which you can find how to implement the API methods with Getx.