Flutter › Flutter Animations Basics

What is an AnimationController in Flutter, and how does it act as the central driver that actually controls the progress and timing of an animation?

Beginner

Answer

An AnimationController is the core object responsible for actually driving an animation forward, managing its current progress value, typically ranging between zero and one, over a specified duration, and controlling whether it is currently playing forward, playing in reverse, or repeating, and most other Flutter animation related widgets and classes are ultimately built on top of and driven by an underlying AnimationController, making it a genuinely foundational building block for understanding how animation actually works throughout the entire Flutter framework.
final controller = AnimationController(
  duration: Duration(milliseconds: 500),
  vsync: this,
);
controller.forward();
Real-world example A custom loading indicator creates an AnimationController with a five hundred millisecond duration, calling forward to begin smoothly animating its visual progress value from zero up to one over that exact specified duration.

Common follow-ups: What does the vsync parameter actually do, and why is it a required parameter for an AnimationController?;How do you properly dispose of an AnimationController to avoid a memory leak?