How do I show or hide password?

binding.showPasswordImageView.setOnClickListener {
    val type = if (binding.textInputEditPassword.inputType != 144) {
        144 // Visible Password
    } else {
        129 // Invisible Password
    }
    binding.textInputEditPassword.inputType = type
}