Cavitation is a condition that occurs in liquid flow where the internal pressure of the liquid, at some point falls below the vapour pressure and vapour bubbles formation takes place. After this point the pressure rises above the vapour pressure again and during this pressure recover stage (recall also the concept of FL) the bubbles collapse, and cavitation takes place.
Flashing is a condition that occurs with liquid flow where the pressure falls below the vapour pressure (same as cavitation) and remains below it. There are then two phases flowing (i.e. liquid and vapour) downstream and no collapsing of bubbles takes place.