Hot take: hourly rates are fine and flat fees mostly hide your sloppy estimating
Everyone says charge by value and never by the hour. I tried flat fees for two years and lost money on about one job in three because I guessed badly. Since going back to hourly with a cap, I earn the same and sleep better. If you cannot say how long something takes, a flat fee is just a bet.