productList method

dynamic productList(
  1. String parentId,
  2. String subGroupId
)

Implementation

productList(String parentId, String subGroupId) async {
  String requestTime = "";
  String responseTime = "";
  BuildContext context = Get.context!;
  Helper.progressDialog(context, "Please wait..");
  addProductList.clear();
  await ApiClient(
    baseUrl: ApiConstant.posBaseUrl,
    onFetchRequestTime: (time) {
      requestTime = time;
    },
    onFetchResponseTime: (time) {
      responseTime = time;
    },
    screenName: "customerManagement",
  )
      .productList(
    pogId: parentId,
    subGroupId: subGroupId,
  )
      .then((value) {
    Helper.close();
    Helper.logEvent(
      "RESPONSE_EVENT",
      success: true,
      endPoint: Api.cpmDropdown,
      responseDate: responseTime,
      screenName: "customerManagement",
      requestDate: requestTime,
    );
    if (value.data?.list != null && value.data!.list!.isNotEmpty) {
      addProductList.clear();
      addProductList.addAll(value.data?.list?.toList() ?? []);
    }
  }).catchError((err) {
    Helper.close();
  });
}