read method

Future<void> read()

Implementation

Future<void> read() async {
  state.loading();
  await UServices.merchant.read(
    p: UMerchantReadParams(
      pageNumber: pageNumber.value,
      pageSize: pageSize,
      title: titleFilter.text.nullIfEmpty(),
      nationalCode: nationalCodeFilter.text.nullIfEmpty(),
      phoneNumber: phoneNumberFilter.text.nullIfEmpty(),
      mcc: businessCategory.value?.code,
      cityCode: selectedCity.value?.code,
      zipCode: zipCodeFilter.text.nullIfEmpty(),
      landline: landlineFilter.text.nullIfEmpty(),
      merchantId: merchantIdFilter.text.nullIfEmpty(),
      userId: user.value?.id,
      bankAccountId: bankAccountIdFilter.text.nullIfEmpty(),
      fromCreatedAt: fromCreatedAt,
      toCreatedAt: toCreatedAt,
    ),
    onOk: (UResponse<List<UMerchantResponse>> r) {
      list = r.result ?? <UMerchantResponse>[];
      totalCount = r.totalCount;
      setTotalPages(r.totalCount);
      setListState(isEmpty: list.isEmpty);
    },
    onError: (UEmptyResponse e) => setError(e.message),
    onException: setError,
  );
}