read method

Future<void> read()

Implementation

Future<void> read() async {
  state.loading();
  await UServices.moadi.read(
    p: UMoadiReadParams(
      pageNumber: pageNumber.value,
      pageSize: pageSize,
      name: nameFilter.text.nullIfEmpty(),
      economicCode: economicCodeFilter.text.nullIfEmpty(),
      nationalCode: nationalCodeFilter.text.nullIfEmpty(),
      uniqueTaxCode: uniqueTaxCodeFilter.text.nullIfEmpty(),
      tags: status.value == null ? null : <int>[status.value!.number],
      userId: user.value?.id,
      fromCreatedAt: fromCreatedAt,
      toCreatedAt: toCreatedAt,
      selectorArgs: const MoadiSelectorArgs(user: UserSelectorArgs()),
    ),
    onOk: (UResponse<List<UMoadiResponse>> r) {
      list = r.result ?? <UMoadiResponse>[];
      totalCount = r.totalCount;
      setTotalPages(r.totalCount);
      setListState(isEmpty: list.isEmpty);
    },
    onError: (UEmptyResponse e) => setError(e.message),
    onException: setError,
  );
}