We report here our systematic studies of excited-state dynamics of two common flavin molecules, FMN and FAD, in five redox states of oxidized form, neutral and anionic semiquinones, and neutral and anionic fully-reduced hydroquinones in solution and in inert protein environments with femtosecond resolution. Using protein environments, we are able to stabilize two semiquinone radicals and thus observed their weak emission spectra. Significantly, we observed a strong correlation between their excited-state dynamics and the planarity of their flavin isoalloxazine ring. For a bent ring structure, we all observed ultrafast dynamics from a few to hundreds of picoseconds and strong excitation-wavelength dependence of emission spectra, indicating deactivation during relaxation. A butterfly bending motion is invoked to get access to conical intersection(s) to facilitate deactivation. These states include the anionic semiquinone radical and fully-reduced neutral and anionic hydroquinones in solution. In a planar configuration, flavins have a long lifetime in nanoseconds except for the stacked conformation of FAD, where the intramolecular electron transfer between the ring and the adenine moiety in 5-9 ps as well as the subsequent charge recombination in 30-40 ps were observed. These observed distinct dynamics, controlled by the flavin ring flexibility, are fundamental to flavoenzyme's functions as observed in photolyase with a planar structure to lengthen the lifetime to maximize DNA repair efficiency and in insect Type 1 cryptochrome with a flexible structure to vary the excited-state deactivation to modulate the functional channel.