Flatline
A flatline is an electrical time sequence measurement that shows no activity and therefore, when represented, shows a flat line instead of a moving one. It almost always refers to either a flatlined electrocardiogram, where the heart shows no electrical activity (asystole), or to a flat electroencephalogram, in which the brain shows no electrical activity (brain death). Both of these specific cases are involved in various definitions of death.

ECG/EKG (Electrocardiogram/Cardiac) flatline

A cardiac flatline is also called asystole. It can possibly be generated by malfunction of the electrocardiography device, but it is recommended to first rule out true asystole because of the emergence of such condition.

Definition:

A cardiac flatline is referred to as asystole. It can be identified by using an ECG/EKG (electrocardiogram) test. Asystole occurs when the electrical and mechanical activities of the heart stop.

Causes:

ECG/EKG flatline or asystole occurs when the heart's electrical and mechanical activities stop. It also results from other causes such as hypoxia, acidosis, hypokalemia, hyperkalemia, hypovolemia, toxins, pulmonary thrombosis, and coronary thrombosis. Additional causes could also include tension pneumothorax and cardiac tamponade. These conditions should be treated immediately when identified.

ECG flat line also occurs when the electrocardiographic (ECG/EKG) leads or recording electrodes are placed incorrectly. It can be caused by malfunction of the electrocardiogram (ECG/EKG) machine.

Diagnosis:

ECG flatline or asystole is diagnosed when a person, who is in cardiac arrest (the heart stops beating), is experiencing the following conditions:

 unresponsive to stimuli,
 without breathing or a palpable pulse.

The eclectrocardiogram (ECG) test records the heart's electrical activity and will show a flat line if the heart stops beating.

EEG (Electroencephalogram/Neurological) flatline 
Definition:

A neurological flatline is referred to as brain death. It can be identified by using an EEG (electroencephalogram) test. Brain death is the loss of function of the brain, the cerebrum, that is responsible for thinking and the deep brain or the brain stem that is responsible for the breathing and reflexes such as pupillary light reflex (the constriction of the pupil of the eye in response to light) and gag reflex or pharyngeal reflex (contraction of pharyngeal muscle).

Causes:

EEG flat line or brain death can result from a head injury that leads to brain damage and bleeding. Brain death also results from a lack of blood flow to the brain because the heart stops beating (cardiac arrest), which is when the ECG imaging shows a cardiac flat line (asystole).

Diagnosis:

Brain death is diagnosed if a person is experiencing all of the following three conditions:

 in a coma and unresponsive to painful stimuli,
 unable to breathe without mechanical ventilation for 10 minutes with an increased blood carbon dioxide level,
 and unresponsive to light (no pupillary light reflex) and throat suctioning (no gag reflex or pharyngeal reflex).

The electroencephalogram (EEG) records the brain's electrical activity and will show a flat line if the brain is dead.

Outcomes 
In a study published in the New England Journal of Medicine, 631 subjects' end of life was observed. Of the 631 subjects, 480 subjects were analyzed using a computer program that recorded each subject's vitals in order to monitor for return of pulse or heart activity after at least 1 minute of flatlining. The study found that 14% of subjects had a return of heart activity but none regained consciousness. Neuro flatline or brain death happens after cardiac arrest or cardiac flatline. It can take 2 to 20 seconds after cardiac flatline for the brain to show no activity.

History 
The definition of death has changed over time, but the loss of cardiac and neurological function have been the main criteria for centuries. The concept of flatlining begins to take form with the invention of technologies for death determination.

It began in 1837 when Professor Manni at the University of Rome offered a cash prize to the doctor who could offer a true test of death. The winner, Dr. Eugene Bouchut used new technology– the stethoscope– to determine death when heart sounds were absent for over two minutes. In 1883 he updated his criteria to require five minutes without heart sounds to qualify cardiac death.

Then, the standard for viewing cardiac activity changed in 1887 when Augustus Waller recorded the first ECG from the human heart with a mercury capillary electrometer. This sparked research into modern ECG technology, which was developed from the mercury capillary electrometer by Willem Einthoven. In 1901 to 1905, Einthoven developed the string galvanometer, which could measure and record the heart's electrical activity. Electrodes were place on three points, the “Einthoven leads”, the right and left arms and on the left foot same as today and provided precise recordings of the heart. This led to Einthoven's Nobel Prize in 1924. With the ECG, the characteristics of a dying heart were identified, creating the leading tool for diagnosing death– even to this day.

However, in the mid 19th century with the invention of the defibrillator and cardioversion, it was realized that the flatline on the ECG did not always mean death. This instigated research into other ways to determine death, which eventually lead to the idea of brain death.

In 1924, a German physiologist and psychiatrist Hans Berger recorded the first EEG on a human brain. The machine consisted of steel electrodes that get mounted on the scalp with an EEG cap to visualize and interpret signals. He noted that the human brain has a specific pattern, called alpha oscillations, and went on to publish this in 1929.  The presence of this technology along with resuscitation technology saw the use of the EEG to determine a time in which the person had reached total death. In 1959, this concept– brain death– was first coined as: "le coma dépassé by Mollaret and Goulon. They determined that a person reached this state when they were apneic, comatose, without brainstem reflexes, and showed no electroencephalographic (EEG) activity.

Treatment and management

Asystole (Cardiac Flatline) 
When an individual experiences asystole or cardiac flatline, there is no electrical activity in their heart which is evidenced by the flatline recorded by an ECG. The lack of electrical activity also means that the individual's heart will stop pumping. Following a cardiac flatline a fast intervention is a priority and can affect individual outcomes and recovery.

Treatment for cardiac flatline or asystole can involve:

 CPR (cardiopulmonary resuscitation)
 Administering a vasopressin such as epinephrine
 Trying to identify what could be causing the cardiac flatline in the first place.

Treatment decisions will depend on where an individual is when they go into asystole. When an individual goes into cardiac arrest providers will start CPR immediately and then try to determine whether the rhythm is shockable. While defibrillation is often portrayed as a common treatment option in popular media, since asystole is an unshockable rhythm defibrillation is not a recommended course of treatment. Successful resuscitation is generally unlikely and is inversely related to the length of time spent attempting resuscitation.

Following a treatment intervention, the individuals who survive may still suffer long-term consequences of their cardiac flatline.

Brain Death (Neurological Flatline) 
An individual's cardiac flatline can progress to neurological flatline, which is also referred to as brain death. After an individual's heart stops beating, if providers are unable to successfully intervene within the window, the individual's brain cells will die from this lack of blood and oxygen and this damage is irreversible and permanent. The criteria to diagnose brain death has been outlined in the above sections of this article. While brain death cannot be treated, individuals and their families have several options  available to them:

 Life support: A diagnosis of brain death can be jarring to an individual's family. Although providers will take the time to educate loved ones on the individual's condition, it can be difficult to fully comprehend a diagnosis of brain death. If the individual is on life support, which includes a combination of mechanical ventilation and medication management, it may appear that they are still breathing and alive although they have been legally declared dead. The machine is artificially keeping the individual "alive" by perfusing blood and providing oxygen. While policies vary depending on the institutional setting, families may choose to continue providing life support. Additionally life support may be continued if individuals are pregnant or are candidates for organ donation. 
 Organ donation: Following a declaration of brain death, with the acceptance of family members or earlier declared wishes of the individual, the individual may be considered as a candidate for organ donation. In order to preserve the viability of the organs for transplantation the individual may be closely monitored and continued on life support.

References 

Cardiac electrophysiology
Medical tests
Signs of death