postApi method
postApi Get request. Params field is required.
Params({ this.queryParameters, required this.endpoint, });
set saveResponse
to 'true' if you would want to save the response
pass savedResponseName
if you'd want to have a unique key assigned to
the saved saveResponse
data. leaving this empty, Activity will set the
key name as the endpoint
.
ActiveResponse({ required this.statusCode, required this.endpoint, this.data, });
ActiveRequest activeRequest = ActiveRequest();
activeRequest.setUp = RequestSetUp(
idleTimeout: 10,
connectionTimeout: 10,
logResponse: true,
withTrustedRoots: true
);
ActiveResponse activeResponse = await activeRequest
.postApi(Params(endpoint: 'https://catfact.ninja/fact'));
You can easily get the saveResponse
value using Memory
Implementation
postApi(Params params, {
bool saveResponse = false,
String savedResponseName = '',
}) async{
return await HttpActiveRequest().postApi(params, setUp, saveResponse: saveResponse,
savedResponseName: savedResponseName);
}