Sally is correct. However, the presence of fungus gnats is often an indication that the soil is not being allowed to dry out sufficiently between waterings. The net result may be root rot and plant death caused not by fungus gnats but by over watering.
Let the soil dry out as much as possible right close to the wilt point. That will deprive the gnat larvae of essential moisture and may also prevent root rot.