getMethodPagination method
Future<Response?>
getMethodPagination({
- required IAuthHelper authHelper,
- required DropDownApiConfig dropDownConfig,
- required int pageNumber,
- required bool isPagination,
- String? searchString,
Method used same as above but this method is enhance with client for cancellation pending request if pending
Implementation
Future<Response?> getMethodPagination(
{required IAuthHelper authHelper,
required DropDownApiConfig dropDownConfig,
required int pageNumber,
required bool isPagination,
String? searchString}) async {
String urlBuild = "";
if (isPagination) {
urlBuild =
"${dropDownConfig.getUrl()}?${dropDownConfig.getSearchKeyNameInUrl()}=${searchString ?? ""}&page=$pageNumber&size=${dropDownConfig.singlePageSize()}&locationId=&sort=firstName,asc";
} else {
urlBuild =
"${dropDownConfig.getUrl()}?size=${dropDownConfig.singlePageSize()}&sort=firstName,asc";
}
Response? response;
response = await http.get(
Uri.parse(urlBuild),
headers: {
"content-type": "application/json",
"accept": "application/json",
'Authorization': await authHelper.getToken(),
},
);
return response;
}