https://www.livescience.com/first-ever-scan-of-dying-brain
After an elderly patient died suddenly during a routine test, scientists accidentally captured unique data on the activity in his brain at the very end of his life: During the 30 seconds before and after the man's heart stopped, his brain waves were remarkably similar to those seen during dreaming, memory recall and meditation, suggesting that people may actually see their life "flash before their eyes" when they die.
The phenomenon of replaying past memories when you die has been reported by some people who have had near-death experiences. But this is the first scientific evidence that this "flash" might be real. However, as this is the only case study, it is impossible to make further assumptions about how common the phenomenon may be or what the experience may be like.