I had the same issue (still having) and discovered something very interesting. FYI, I tried a factory reset, safe mode, and cleaning options and still did not work.
In the beginning, holding down the lock and volume-down keys buttons for a hard reset and then plugging in the charging cable (let's call it Solution 1.1) worked in some cases.
Long story short:
Option 1: I was doing Solution 1.1 with a 5Volts/1Amps charger and it worked but no fast charging.
Option 2: I try again Solution 1.1 using the Samsung charger ("fast charging") of 5Volts/2amps and it did not work.
You probably will think it was damaged and/or wet but it was not. When I unplugged the cable while in Option 1 to try to plug it into the Samsung charger (for fast charging) the "Moisture detected" error/message appeared immediately.
For sure, this is a software issue and/or something related to the actual charger (not the USB cable).
I hope this works for you and everybody.
P.D. The 5V/1A charger used on Option 1 was a simple lamp with a USB connection. Those types of lamps you can get in almost any store. Probably it will work with any 5V/1A charger.
I have S9 and i have this phone around 1 year but today i got a problem.The phone charging normaly when is on but when i power off the phone when i pluged in it vibrates and showing a drop of water and a yellow triangle and dosent charge.Can I fix this
Moisture warning in S or A phones using a C or B connector.
If you are adamant your phone has not come into contact with moisture it is probably dirt on the charging contacts. These ports are really small but this is what I used.
100 x 2mm cable tie
2mm strip of kitchen towel
Carefully glue the towel strip to both sides of the fine pointy end of the cable tie,
let it dry. Dip it in the isopropyl, carefully clean the contacts in the port without disturbing the centre prong or leaving any paper in it. Let it dry before plugging in to charger.
I can't be responsible for stupidity or no skills. but it certainly works for me.