If the phone is very hot or cold, a nearly exhausted battery can prevent the flashlight from working. You may have accidentally removed your flashlight from your iPhone 12 Control Center, but you can easily add it back in the Settings app.