read method

Future<void> read()

Implementation

Future<void> read() async {
  state.loading();
  await UServices.merchant.read(
    p: UMerchantReadParams(
      pageNumber: pageNumber.value,
      pageSize: pageSize,
      title: titleFilterController.text.nullIfEmpty(),
      nationalCode: nationalCodeFilterController.text.nullIfEmpty(),
      phoneNumber: phoneNumberFilterController.text.nullIfEmpty(),
      mcc: businessCategory?.code,
      cityCode: city?.code,
      zipCode: zipCodeFilterController.text.nullIfEmpty(),
      landline: landlineFilterController.text.nullIfEmpty(),
      merchantId: merchantIdFilterController.text.nullIfEmpty(),
      userId: user?.id,
      bankAccountId: bankAccountIdFilterController.text.nullIfEmpty(),
      fromCreatedAt: startDate,
      toCreatedAt: endDate,
    ),
    onOk: (UResponse<List<UMerchantResponse>> r) {
      list = r.result ?? <UMerchantResponse>[];
      setTotalPages(r.totalCount);
      list.isEmpty ? state.emptying() : state.loaded();
    },
    onError: (UEmptyResponse e) => setError(e.message),
    onException: setError,
  );
}