There are many possible causes of flashes of light or photopsia. It can be harmless or extremely dangerous for your eyes. You need to check if you have other symptoms for further recognition of your problem.
Firstly, flashes of light can be a sign of migraine. Flashes appear as sparks, zigzag line, or geometric patterns in the peripheral field of vision.
Secondly, flashes occurs when there is retinal detachment or retinal tear. In this case, emergent medication is necessary, other wise permanent vision loss will happen.
Thirdly, flashes are caused by posterior vitreous detachment as a result of natural aging process. There is no cure for this, but the patient still needs regular examinations.