Last night whilst driving the engine just cut off .the light was of . I switched off the ignition key, and started the engine anew it ran perfectly. My car is a corolla sedan 2008.
I would suspect the ignition switch
One thing that can cause the engine to shut off while driving is a faulty crankshaft position sensor.
If the computer loses the signal from this sensor, the computer see’s no reason to operate the fuel and ignition systems, and the engine cuts off.
I think you are saying that when the engine shut off the lights on the dashboard went off, too. Is that so?
If you have other keys on a ring or in a case with your car key, try using the car key by itself, no other keys or case. Sometimes the weight of a bunch of keys can wear the ignition switch and make it fail.