getApi method
getApi 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
.getApi(Params(endpoint: 'https://catfact.ninja/fact'));
You can easily get the saveResponse
value using Memory
Implementation
getApi(Params params, {
bool saveResponse = false,
String savedResponseName = '',
}) async{
return await HttpActiveRequest().getApi(params, setUp, saveResponse: saveResponse,
savedResponseName: savedResponseName);
}