Electronic candle flicker devices have become ubiquitious over the past 20+ years. Several manufacturers make them. They are relatively easy for an electronics hobbyist to build, too.
These little devices do not work well when driven directly by a pulse-width-modulation (pwm) dimmer. This is because pwm is a rapid series of power on-off cycles. Electronic devices will restart on each pulse, which disturbs their intended internal timing pattern.
The solution is an “integrator” that converts pwm periods into continuously variable DC voltage. When the pulse width is low, a low DC voltage is produced; when the pulse width is high, a higher DC voltage is produced.
A simple resistor-capacitor (r-c) network takes care of this! Watch this video to learn more.