Hopefully the problem fixed itself and was a temporary glitch, like a piece of dust or bug got pinched between the contacts. The flasher was a $5 fix in my Jeep so the obviously first thing to try.
If all your vehicle's electronics are controlled by a computer like my Subaru Outback then restarting the car might have fixed the problem like restarting a Windows computer fixes a networking problem. Disconnecting the battery for 15 minutes is also a common suggestion to fix electronic gremlins.
I would think the flasher circuit is hard wired to the battery and should work whether the vehicle is on or off. Intermittent operation would indicate a short or the ground has corrosion and compromised. If the vehicle is started using a key then the ignition switch would be suspect. A heavy set of keys hanging from the switch will wear it out. The battery may be weak and getting ready to die, when the vehicle is running the flasher circuit is getting the full 12 volts.
For now do nothing. The first rule of mechanics is "If it works, don't f**k with it."
If the flasher becomes an intermittent problem, the only way to fix it is to wait until it doesn't work at all. I had intermittent problems with my Wagoneer all the time, my mechanic said "Drive it until it drops."
A technical service manual will have the wiring diagram for the flasher circuit. All solutions will lead to removing the dash.