getItemList method

Future<List> getItemList({
  1. required Map params,
})

Implementation

Future<List<dynamic?>> getItemList({required Map params}) async {
  var extras = "";

  params.forEach((key, value) {
    extras += extras != "" ? "&" : "";
    var baseKey = key;
    if (['order_by', 'limit', 'skip'].indexOf(key) > -1) baseKey = "_$key";
    extras += "$baseKey=$value";
  });

  extras = extras != "" ? "?$extras" : "";
  final headers = {"Authorization": "Bearer ${systemBox.read("jwt")}"};
  final response = await get("/$itemUrl/", headers: headers);
  // if (response.statusCode != 200) throw Exception(response.statusCode);
  return response.body;
}