block method

Future<void> block()

Blocks the user for the authenticated MyUser.

Only meaningful, if this chat is a dialog.

Implementation

Future<void> block() async {
  try {
    if (user != null) {
      await _userService.blockUser(
        user!.id,
        reason.text.isEmpty ? null : BlocklistReason(reason.text),
      );
    }
    reason.clear();
  } on BlockUserException catch (e) {
    MessagePopup.error(e);
  } catch (e) {
    MessagePopup.error(e);
    rethrow;
  }
}