Let's first understand how a Ticker is different from a Timer.
Timer in Flutter is a general purpose timer where you can provide a duration after which the Timer fires. So it's meant for discrete timer events where the event will fire (possibly periodically) after the stipulated amount of time. So it can be used to periodically update a UI state in an interval and then rebuilding the whole UI tree by some means.
Ticker on the other hand is a UI specific timer that fires depending on the frame rate of the app. So if an app is capable of drawing 60 frames per second, the Ticker will fire 60 times a second. So this is more suitable for drawing twinned animation frames, drawing one frame on each screen refresh cycle. Thus AnimationController uses a Ticker (by means of TickerProvider and TickerProviderMixin) under the hood to smoothly twin from one UI state to another and drawing each intermediate frame on screen on every screen refresh cycle.
For discrete, perpetual animation (like drawing an analog clock where the second hand changes position each second) using a Timer instead of Ticker doesn't really imply any significant visual difference in the UI. However, in terms of performance and testing, a Ticker provides significant advantages over a Timer:
- Unlike
Timer, Ticker mutes itself when the animation is not on screen, avoiding unnecessary rendering overhead. So if a new screen is presented over your clock screen Ticker will pause itself and subsequently the animation will also pause, avoiding unnecessary GPU rendering calls. The Timer however will continue to fire its events and will keep updating the clock UI in the background.
- With
Timer you don't have control over refresh rate of your clock. So there can be frame drop if the previous screen update is underway and another timer events fires, requesting another update of the widget tree. This could give a visually jagged update in the UI.
Ticker is optimized for testing. It can mocked, can be slowed down or fast forwarded for testing purpose.
And for smooth and continuous twinning transition Timer is almost always useless because you cannot control your drawing on every screen refresh cycle, simply because Timer doesn't give you any control over the frame rate of your app. On the contrary, since Ticker (and the AnimationController) only performs its drawing only based on screen refresh rate (frame rate), it is almost given that it is the only option when a twinning animation is necessary.
This article nicely elaborates the use cases and differences that you might find useful if you are split between the approaches of using a Timer vs a Ticker (and AnimationController in general) for your use case.