read method

Future<void> read()

Implementation

Future<void> read() async {
  final UUserResponse? u = selectedUser.value;
  if (u == null) return;
  state.loading();
  await UServices.wallet.readByUserId(
    p: UIdParams(id: u.id),
    onOk: (UResponse<List<UWalletResponse>> r) async {
      wallets.value = r.result ?? <UWalletResponse>[];
      state.loaded();
      final (UResponse<List<UWalletTxnResponse>>? t, UEmptyResponse? e, String? x) = await UServices.wallet.readTxn(p: UWalletTxnReadParams(userId: u.id, pageSize: 50, pageNumber: 1));
      if (t == null) UToast.error(message: e?.message ?? x ?? U.s.errorReadingData);
      txns.value = t?.result ?? <UWalletTxnResponse>[];
      summary.value = (await UServices.accounting.report(p: UAccountingReportParams(userId: u.id))).$1?.result;
    },
    onError: (UEmptyResponse e) => setError(e.message),
    onException: setError,
  );
}