getPageData function

Map<String, String> getPageData(
  1. int fromItem,
  2. PaginationOrder order,
  3. int limit
)

Sets the query parameters related to pagination @param {int} fromItem - Item from where to start the request @returns {object} Includes the values fromItem and limit @private

Implementation

Map<String, String> getPageData(
    int fromItem, PaginationOrder order, int limit) {
  Map<String, String> params = {};
  if (fromItem != null && fromItem > 0) {
    params.putIfAbsent('fromItem', () => fromItem.toString());
  }
  params.putIfAbsent('order', () => order.toString().split(".")[1]);
  params.putIfAbsent('limit', () => DEFAULT_PAGE_SIZE.toString());
  return params;
}