Yes, anxiety can cause flashing lights. Anxiety can cause problems in all area of the body, and vision problems from anxiety are quite common. One of these vision problems is that your eyes may show sensitivity to light and even see flashing lights when you have them closed. Because when your brain is in anxiety, it prepares for the fight or flight experience. Your brain sends a message to the eyes to sharpen vision. Sometimes the change is too dramatic or only occurs partially, causing flashes.
And there are also some other reasons flashing lights as follows:
(1)Migraine with aura
(2)Ophthalmic migraines
(3)Retinal migraine
(4)Vitreous separation
(5)Retinal tear or detachment
And if you know it's anxiety what causes your eye problems, find ways to relieve the stress. You can take more relaxation, or take some meditation or do some self-hypnosis to decrease your anxiety levels.