Interview frequency: …
Short answer
Implicit animations manage the controller automatically once a property value changes (such as AnimatedContainer), while explicit ones give you full control through AnimationController to start the animation, stop it, reverse it, or repeat it.
Explanation
Implicit animations rely on ready-made widgets that inherit from ImplicitlyAnimatedWidget, which handle the duration and curve internally once a rebuild occurs with a new value. Explicit animations require TickerProviderStateMixin and manual management of the AnimationController lifecycle, and are used when you need complex, synchronized, endlessly looping, or gesture-driven animations.
Code example
// Example Implicit Animation:
AnimatedContainer(
duration: const Duration(milliseconds: 300),
curve: Curves.easeInOut,
width: isExpanded ? 200.0 : 100.0,
height: 50.0,
color: isExpanded ? Colors.blue : Colors.grey,
)Common mistakes
- Building a custom, complex AnimationController for a very simple animation such as animating width or opacity, when AnimatedContainer or AnimatedOpacity is enough.
- Forgetting to call dispose() on the AnimationController in explicit animations, causing a memory leak.