2D Flashlight

I need to make a flashlight for my 2D game but I’m not sure how to go about it and all the stuff that I found on the internet was for topdown games but I need it for a platformer style game where the player has a flashlight that illuminates stuff infront of him like this:

Any idea on how I could go about doing this?

How about this?

2D Flashlight Editor: