Indeed, National Gardening Association forum member Linneaj suggests freezing then baking potting soil to kill fungus gnats — ...
Choose the right potting mix (and inspect before using) Fungus gnats love the organic matter in moist, nutrient-rich soil, ...