handleRequest method
Future<Response?>
handleRequest(
)
Implementation
Future<http.Response?> handleRequest() async {
switch (apiConfig.requestType) {
case RequestType.GET:
{
return await http.get(
Uri.http(
CCRestApi.options.baseUrl,
apiConfig.endpoint,
parameters,
),
headers: headers,
);
}
case RequestType.POST:
{
return await http.post(
Uri.http(CCRestApi.options.baseUrl, apiConfig.endpoint),
body: json.encode(data),
headers: headers,
);
}
case RequestType.DELETE:
return await http.delete(
Uri.http(CCRestApi.options.baseUrl, apiConfig.endpoint),
body: json.encode(data),
headers: headers,
);
default:
print('Unknown request type');
}
return null;
}