Mobile Development 18 min read

How Fish‑Lottie Brings High‑Performance Lottie Animations to Flutter and Android

This article explains the design and implementation of a pure‑Dart Lottie animation library for Flutter, covering its architecture, data parsing, rendering pipeline, code examples for both Android and Flutter, performance comparisons, and future plans for interactive features.

Alibaba Terminal Technology
Alibaba Terminal Technology
Alibaba Terminal Technology
How Fish‑Lottie Brings High‑Performance Lottie Animations to Flutter and Android

Background

Lottie is an open‑source animation solution from Airbnb that uses JSON to reduce development cost for complex animations across Android, iOS, Web and other platforms.

Project Architecture

After studying the official lottie‑android library, the Xianyu team built a pure‑Dart package that provides complete, high‑performance Lottie support for Flutter. The architecture consists of a base module, an interface layer and a component layer, supporting vector graphics, fills, strokes and other capabilities similar to lottie‑android.

Architecture diagram
Architecture diagram

Base Module

The base module interacts directly with Flutter SDK capabilities. It includes data‑model, animation‑rendering, data‑parsing and utility modules. JSON animation files are parsed into a LottieComposition object, which is then handed to the rendering module.

Interface Layer

The interface layer receives JSON data, creates a LottieComposition, passes it to LottieDrawable, which forwards it to the rendering module. LottieDrawable drives drawing and refresh based on animation progress.

Component Layer

Developers create a LottieAnimationView widget, provide the JSON path (asset, URL or file), and optionally an AnimationController, width, height, alignment, etc., to embed the animation in the Flutter UI.

@override
void paint(PaintingContext context, Offset offset) {
  if (_drawable == null) return;
  _drawable.draw(context.canvas, offset & size,
      fit: _fit, alignment: _alignment);
}
// RenderLottie paint method

Workflow

Designers create layers in After Effects, export to JSON via BodyMovin, then the framework parses the JSON, builds a composition, and uses AnimationBuilder to drive progress, causing the drawable to repaint each frame.

Workflow diagram
Workflow diagram

Rendering and Playback

AnimationBuilder

updates AnimationController.value, which sets LottieDrawable.progress, triggers repaint, and the drawable draws each layer according to the current keyframe values.

Differences

Compared with existing third‑party solutions, fish‑lottie avoids flicker and supports text animation, offering performance comparable to native lottie‑android.

Future Outlook – From Static to Interactive

Interactive capabilities such as dynamic property control (e.g., color changes via KeyPath) are being added. A PropertiesController will replace the Android‑style addValueCallback, enabling complex interactive animations driven by user input.

val shirt = KeyPath("Shirt", "Group 5", "Fill 1")
animationView.addValueCallback(shirt, LottieProperty.COLOR) { Colors.XXX }
// Dynamic color change on Android
interpolator = PathInterpolator.cubic(cp1.dx, cp1.dy, cp2.dx, cp2.dy);
// Flutter cubic Bézier interpolator
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

FlutterLottieAndroid
Alibaba Terminal Technology
Written by

Alibaba Terminal Technology

Official public account of Alibaba Terminal

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.