"In a flash" is an English idiom that refers to something that happens in an instant or in a very fast nature. This can refer to something that happens instantaneously or something that will only take a short amount of time from the time when the phrase is spoken. Another way to use "in a flash" is as a means of conveying that something, like an idea, has come upon someone in a very sudden fashion. The phrase gets its meaning from the way that a flash of lightning appears in an instant without any warning.
It is common for people speaking English to use words or short phrases which have accepted meanings that are far different from what one might expect from the literal definitions of the words they contain. These words and phrases are known as idioms, which can be extremely useful in allowing speakers to sound more colloquial and colorful with their conversations. Idioms get their meanings not from their literal definitions or even from the way they were first used but rather from the way they are used in a culture. One idiom that denotes a sudden action is the phrase "in a flash."
If something is described in this manner, it means that it will occur or has already occurred in a very brief window of time. There is usually some amount of exaggeration involved, but listeners familiar with the idiom can distinguish this and understand the intent of the speaker. As an example of how this phrase is used, consider the sentence, "I know you're worried about me going, but I'll be back in a flash."
There are also occasions when this phrase is used to describe a thought or idea which appears in someone's brain very quickly out of nowhere. It is often used to describe someone who has been searching in vain for some sort of inspiration until it quickly arrives. For example, someone might say, "I was stuck on the answer to that test for an hour but then it came to me in a flash."
The meaning of this phrase comes from the manner in which lightning strikes. Lightning provides a flash of light which illuminates a dark sky for a brief moment before disappearing just as quickly. As a result, it provides a good basis for this idiomatic expression. "In a flash" is not to be taken literally, but the figurative allusion to speed is quite clear.