Animation undoubtedly creates great-looking apps. Unless done correctly though, it can also create a great pile of mess in your codebase. Having covered the core principles of animation in the previous part, we can move towards a much cleaner UI code and also its reusability by utilizing AnimatedWidget and AnimatedBuilder.
While it’s true that animation is simply done by rebuilding the UI multiple times per second, doing this naively by calling setState is not the best option. At the very least, this creates unnecessary boilerplate. What’s even worse, it tightly ties the animation with the widget which is being animated.