dialog property

  1. @override
Rx<RxChat?> get dialog
override

Returns reactive value of the RxChat-dialog with this RxUser.

Implementation

@override
Rx<RxChat?> get dialog {
  final ChatId dialogId = user.value.dialog;
  if (_dialog == null) {
    final FutureOr<RxChat?> chatOrFuture = _userRepository.getChat?.call(
      dialogId,
    );

    if (chatOrFuture is RxChat?) {
      _dialog = Rx(chatOrFuture);
    } else {
      _dialog = Rx(null);
      chatOrFuture.then((v) => _dialog?.value = v);
    }
  }

  return _dialog!;
}