read method

Future<void> read()

Implementation

Future<void> read() async {
  state.loading();
  await UServices.hotel.readHotelRooms(
    p: UHotelRoomReadParams(
      pageNumber: pageNumber.value,
      pageSize: pageSize,
      hotelId: hotel?.id,
      title: titleFilter.valueOrNull(),
      minPrice: minPriceFilter.isNullOrEmpty() ? null : minPriceFilter.numDouble(),
      maxPrice: maxPriceFilter.isNullOrEmpty() ? null : maxPriceFilter.numDouble(),
      selectorArgs: const HotelRoomSelectorArgs(hotel: HotelSelectorArgs()),
    ),
    onOk: (UResponse<List<UHotelRoomResponse>> r) {
      list = r.result ?? <UHotelRoomResponse>[];
      setTotalPages(r.totalCount);
      setListState(isEmpty: list.isEmpty);
    },
    onError: (UEmptyResponse e) => setError(e.message),
    onException: (String e) => setError(),
  );
}