Menu

1 / 5

animate_chain: chained Flutter animations without the lifecycle leaks

DEV Community: flutter·Abdeldjalil Chougui·2 days ago
#kVHJtjm6
#devtoflutter#devto#dev#animate#effect
Reading 0:00
15s threshold

Chained animation syntax made Flutter animations pleasant to write. Instead of a StatefulWidget , an AnimationController , a Tween and an AnimatedBuilder , you write widget.animate().fadeIn().slideY() and move on. flutter_animate made this style popular.

The style has a cost when the lifecycle is not handled carefully. The animate_chain README lists the issues it found in flutter_animate 4.5.2, each with a link to the upstream issue: a delay that still fires after the widget is removed and calls forward() on a disposed controller, onComplete firing several times, a CurvedAnimation created on every build and never disposed, and a shimmer that rebuilds a ShaderMask every frame.

animate_chain covers the most-used core of the flutter_animate API in a clean-room rewrite, and fixes those lifecycle problems.

What it does

Chained or declarative.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.