You could wash a hat in the shower but if it requires more than simply wetting it and a quick scrub, it’s going to be wasteful of water and it’d be better to hand wash it in a tub. Also, if you like hot showers, this isn’t good for your hat. Since it’s just easier to concentrate on cleaning yourself in the shower and on the hat in a tub, wash the hat out of the shower.