getGrnTransationList method

void getGrnTransationList(
  1. String filterExternalReferenceId
)

Implementation

void getGrnTransationList(String filterExternalReferenceId) async {
  try {
    Helper.progressDialog(Get.context!, "Please wait..");
    await ApiClient(baseUrl: ApiConstant.armBaseUrl)
        .getGrnTransactions(
      filterStatus: "IN_TRANSIT",
      filterPartnerId: storage.read("PARTNER_ID_LOGIN"),
      filterExternalReferenceId: filterExternalReferenceId,
      sort: "id",
      orderBy: "ASC",
      pageNo: 0,
      perPageCount: 10,
    )
        .then((value) {
      Get.back();
      grnTransactionList.value = value.data?.content ?? [];
      if (grnTransactionList.length == 1 || grnTransactionList.length > 1) {
        showGrnButton.value = true;
      }
    }).catchError((onError) {
      ArmErrorResponse res = ArmErrorResponse.fromMap(
        onError?.response?.data,
      );
      Get.back();
      Helper.messageDialog(
        Get.context!,
        res.errors?[0].errorCode ?? "Try again!!",
        res.errors?[0].errorMessage ?? "Something went wrong",
      );
    });
  } catch (e) {
    print('error $e');
    Get.back();
  }
}