getServiceParent method

dynamic getServiceParent({
  1. required String parentId,
})

Implementation

getServiceParent({required String parentId}) async {
  String requestTime = "";
  String responseTime = "";
  await ApiClient(
    baseUrl: ApiConstant.baseUrl,
    onFetchRequestTime: (time) {
      requestTime = time;
    },
    onFetchResponseTime: (time) {
      responseTime = time;
    },
    screenName: "customerManagement",
  )
      .getServiceParent(
    dealerId: parentId,
    xUserId: SecureStorageService.readSecureData(
      SecureStorageService.xUserId,
    ) ?? "",
  )
      .then((value) {
    Helper.logEvent(
      "RESPONSE_EVENT",
      success: true,
      endPoint: Api.cpmDropdown,
      responseDate: responseTime,
      screenName: "customerManagement",
      requestDate: requestTime,
    );
    if (value.responseMessage == "Success" &&
        value.response != null &&
        value.response!.isNotEmpty) {
      serviceParent.value = value.response![0].name ?? "-";
    }
  }).catchError((err) {});
}