Variety and quality are the most important things to consider when coming up with a proper diet for your fish. Flakes are not recommended for bettas because they aren't very high quality, and because they are more difficult to digest. Fish were not designed to break down and digest dry, bready air-filled foods. It is similar to when we eat uncooked noodles or rice, in that the food expands in the fish's gut, causing bloating and constipation.
I recommend using a high quality pellet brand, if you can afford two brands, then that is even better. No single pellet formula can provide your fish with complete nutrition, after all. Omega One Betta Buffet Pellets, Atison's Betta Pellets, Ken's Betta Crumbles, and New Life Spectrum are all good brands. You should also consider supplementing your fish's diet with frozen foods like blood worms (for protein) and brine shrimp (for fiber) a few times a week. Try to avoid freeze-dried foods, they can cause very severe constipation and aren't as rich in nutrients as frozen food. If you must use dry food like flakes, pellets, and freeze-dried foods, make sure you soak them in a bit of tank water until they are rehydrated. It will make the dry food easier to digest and more palatable to your fish.
Good luck!