I have almost the same problem of the flat foot (not severe problem but bad enough). As I am in physiotherapy and performance training business I ‘ve asked many people (experts in their field) what I should do. From sports physios and orthopaedic doctors to CrossFit trainers to professional weightlifters.
After trying different approaches, this is what I found out working best for me.
I bought custom made insoles (after doing gait analysis etc. by certified physios) so to start fixing slowly my posture problem and start strengthening the muscles of the foot etc. I am wearing these insoles daily, and every 3-4 of months I change them accordingly, with the new adaptations needed.
Also, I do a mixed training, which means sometimes I do heavy lifts barefoot (or with flat shoes) and others with special Olympic shoes (also with insole custom made for sports) and I am going to explain why.
With lifting shoes, of course, I lift a bit heavier while keeping better posture.
Barefoot, while I lift less heavy, I train my body to overcome my structural difficulties and working better as a whole system.
So, I do both. But please keep in mind that I do not train for the competition just for fun. I think that if competition were my goal I would prefer to lift more with shoes, as sometimes the proper shoe can win a medal (as you lift heavier).
Now, as far as your knees are concerned, lifting heavy while barefoot and flat feet, makes your knees fall inside and this could cause damage to the anterior cruciate ligament as well as the IT band.
It's hard to know if you have bad knees due to this or other conditions (also you need to define bad knees) but sure the wrong way of lifting can make things worse.
Hope my answer helped you at least a bit. I wish you all the best!!