Those tiny flies hovering over a pot are annoying, and they are also a clue. For most common houseplants, that pattern points to soil that stays wet on top, which gives the flies a place to breed. The fix is not dramatic. It is drier surface soil, a cleaner pot top, and patience while the cycle breaks.
Start with the soil, not the flies
Press a finger into the top layer, or check the soil before you water again. If the surface is still damp days after watering, hold off. Letting the top soil dry between waterings takes away the damp breeding spot the flies rely on. As a rule of thumb, water only when the plant and the soil show it is time, then water thoroughly and let excess drain away.
Clean up the surface
Pick dead leaves off the soil surface and clear fallen debris from the pot. Decaying leaves on damp soil make the problem worse, and a clean surface is easier to keep an eye on. Wipe the outside of the pot too, so you can see fresh activity clearly instead of guessing.
Keep checking while you wait
This takes time. Flies already in the soil finish their cycle even after you change the watering habit, so a few stragglers do not mean the fix failed. Keep checking moisture before each watering, keep the surface clean, and give the dry down step time to work. Fungus gnats are the most common cause for this pattern, though they are not the only possible fly, so if the problem keeps growing despite drier soil, look again at drainage and airflow around the pot.
A moisture check aid can make the dry down step easier to judge. Soil Sense is a WiFi plant sensor 2-pack for $39.99 that tracks moisture, light, and temperature, and tells your phone when something needs attention. It will not remove pests on its own, but it helps you know when the soil is actually dry enough to water again. Bloom wherever you are, starting with soil that is not staying soggy.