Implement staggered animations using a single AnimationController and Interval
This tests multiplexing one ticker into sequential animations. Use one AnimationController, map each Tween to an Interval on distinct 0-to-1 sub-ranges, and rebuild with AnimatedBuilder. Red flag: multiple controllers or manual forward chaining.
WHAT THIS TESTS: This question tests whether you understand how to multiplex a single animation timeline into multiple sequential or overlapping effects without spawning extra tickers. Interviewers care that you know Interval is not just an easing curve but a time-windowing primitive, and that you understand the difference between the controller's global progress and each animation's local progress.
A GOOD ANSWER COVERS: First, instantiate one AnimationController with a TickerProviderStateMixin or SingleTickerProviderStateMixin and a total duration that covers the entire stagger sequence. Second, create individual Animation objects for each property or widget by calling Tween.animate with a CurvedAnimation whose curve is an Interval with explicit begin and end values between 0.0 and 1.0. Third, explain that Interval remaps the controller's global value to a local zero-to-one range only within its window, so the animation stays clamped outside that slice. Fourth, wire each Animation to an AnimatedBuilder or AnimatedWidget so the tree rebuilds only where necessary. Fifth, trigger the whole sequence with a single call to controller.forward.
COMMON WRONG ANSWERS: A red flag is suggesting one AnimationController per widget, which wastes tickers and can desync. Another mistake is calling controller.forward, awaiting completion, then calling forward again for the next step, which defeats the purpose of a staggered animation and forces imperative state management. Some candidates also think Interval controls easing speed rather than time placement, or they forget that Interval curves can overlap for parallel motion and can be paired with a separate reverse curve argument.
LIKELY FOLLOW-UPS: The interviewer might ask how you would make the sequence responsive to user input, such as reversing mid-sequence; the answer is that because everything shares one controller, controller.reverse scrubs the whole stagger backward uniformly. They might ask how to add overlap so animations do not wait for the previous one to finish; you simply set Interval begin values before the prior Interval ends, for example 0.0 to 0.5 and 0.3 to 1.0. They might also ask about performance, and you should mention that AnimatedBuilder limits rebuilds and that one ticker is cheaper than many.
ONE CONCRETE EXAMPLE: Imagine three buttons fading and sliding in. The controller runs for 900 milliseconds total. The first button uses an Interval from 0.0 to 0.33, the second from 0.33 to 0.66, and the third from 0.66 to 1.0. Each button gets its own Animation created by a Tween beginning at 0.0 and ending at 1.0, animated with CurvedAnimation parent controller and curve Interval begin end. When controller.forward runs, the first button animates during the first third, the second during the middle third, and the last during the final third, all driven by the same ticker.
Read the original → docs.flutter.dev
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.