AnimationsEasy20 XP3 min read
What is the difference between implicit and explicit animations?
TL;DR: Implicit animations (AnimatedContainer, AnimatedOpacity) automatically animate between property changes with no controller needed. Explicit animations (AnimationController + AnimatedBuilder) give full control over start, stop, loop, and custom interpolation.
Full Answer
Flutter offers two tiers of animation APIs designed for different levels of complexity.
| Aspect | Implicit | Explicit |
|---|---|---|
| Setup | Just change a property value | AnimationController + vsync |
| Control | Auto-animates on rebuild | Forward, reverse, repeat, stop |
| Examples | AnimatedContainer, AnimatedOpacity, TweenAnimationBuilder | AnimationController, AnimatedBuilder, AnimatedWidget |
| Best for | Simple property transitions | Complex, looping, or coordinated animations |
๐ฏ
Start with implicit. Upgrade to explicit only when you need control beyond 'animate when value changes'.
Code Examples
dartImplicit vs Explicit comparison
Output
// Implicit: tap to expand/collapse // Explicit: can loop, sequence, and precisely control playback
Common Mistakes
- โUsing explicit animations when implicit would suffice โ unnecessary boilerplate
- โForgetting the child parameter in AnimatedBuilder โ passes non-animated subtrees as a cache
Interview Tip
๐ก
The 'child' parameter in AnimatedBuilder is often overlooked in interviews. Explain that passing the non-animated subtree as child prevents it from being rebuilt on every frame.
#implicit-animation#explicit-animation#animated-container#animation-controller