Check to see if it is getting spark
Check to see if it is getting fuel
check your MAF. if it is disconnected or bad the car will do exactly as you state. it is usually located on the air cleaner assembly.
Change the cam sensor
There are several reasons why a car would start and then shut off immediately. It could be battery cables, a fuel problem, or even a bad spark plug.
It starts at 23,000
In hot weather my Honda Accord 2000 starts but idles rough and dies.
When was the last time you gave it a tune-up? Try that first. and go from there.
Acura. Accord. Arrow. Audi. AMC.
It is a common problem for shevy. Usually the Fuel regulator. Or for other vehicles it could be a dirty fuel filter
Since the dashboard lights are flickering, it sounds like a possible wiring problem. Check all of the main wires from the battery to start with, then check the fuse box for any loose wiring.
VW Polo Classic 1999. Starts OK but cuts out almost immediately. No history or warning of problem - just arose out of the blue one evening. Turned that the fuse controlling the brake-lights had blown. Replaced fuse; car starts no problem.
My Sister-in-law had a simmilar problem, ending up being the ignition switch. trying jigling the key when it starts to cut out.
Turn the ignition switch clockwise until it starts, then release.
check your ignition coil. that's what happen to me when the engine get hot the car stop.