It's "ok" to feed just flake/pellets, but there are important reasons that indicate a varied diet is preferable:
1. In the wild, fish eats a variety of food, not just "worms" or "veggies" all the time.
2. As Pandemonium said, prevention is better than cure. Just like us, a varied diet is much much healthier.
3. Flake or pellets, however expensive or "complete" as the package says, is only a staple, and will not all provide all the needed nutrition.
My fishies' diet includes 2 kinds of pellets, algae wafer, peas, zucchini and bloodworms.
So, if I eat meat, veggies and all sort of wonderful things, why not my fishies

?
cheers