Introduction
Animations can bring mobile apps to life by guiding users and reinforcing brand identity. Rive is a powerful vector-based animation tool that simplifies the creation of interactive, resolution-independent animations. Integrating Rive with Flutter leverages Flutter’s rendering engine and hot reload to deliver smooth, performant animations in cross-platform mobile development. This tutorial walks through setting up Rive, designing an animation, importing it into a Flutter project, and controlling it in real time.
Getting Started with Rive
Before diving into Flutter, install Rive’s desktop or web editor at rive.app. Create a new file and use shapes, bones, and keyframes to craft an animation. Rive’s state machines let you define artboards with multiple animation inputs—booleans, triggers, or numbers—so you can coordinate motion based on user interaction or app state. After designing, export the .riv file.
Key steps:
• Build vector assets with layers and bones.
• Animate properties like position, scale, and opacity.
• Set up a state machine and name inputs logically.
• Export the .riv asset.
Integrating Rive into Flutter
Add the rive package to pubspec.yaml under dependencies:
dependencies:
flutter:
sdk: flutter
rive
Run flutter pub get. Place your animation file in assets/animations/my_animation.riv and declare it:
In your Dart code, import the package and load the artboard:
import 'package:rive/rive.dart';
class RiveWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return RiveAnimation.asset(
'assets/animations/my_animation.riv',
fit: BoxFit.contain,
);
}
}This renders your animation in the widget tree with default looping.
Controlling Animations at Runtime
To trigger specific state machine inputs, use a RiveAnimationController. First, create a state machine controller and attach it to the artboard:
class ControlledAnimation extends StatefulWidget {
@override
_ControlledAnimationState createState() => _ControlledAnimationState();
}
class _ControlledAnimationState extends State<ControlledAnimation> {
late StateMachineController _controller;
SMITrigger? _trigger;
void _onInit(Artboard artboard) {
_controller = StateMachineController.fromArtboard(
artboard, 'State Machine 1')!;
artboard.addController(_controller);
_trigger = _controller.findInput<bool>('activate') as SMITrigger;
}
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () => _trigger?.fire(),
child: RiveAnimation.asset(
'assets/animations/my_animation.riv',
onInit: _onInit,
),
);
}
}This code locates the trigger named "activate" and fires it on tap, causing the state machine to transition between animation states.
Best Practices for Performance
• Minimize artboard complexity: simplify vector paths and reduce node count.
• Reuse controllers: keep a single StateMachineController per artboard instance.
• Use texture compression: package .riv assets with appropriate compression for iOS and Android.
• Profile with Flutter DevTools to ensure 60fps. Rive’s GPU-accelerated rendering pairs well with Flutter’s Skia engine, delivering smooth animations even on mid-range devices.
Vibe Studio

Vibe Studio, powered by Steve’s advanced AI agents, is a revolutionary no-code, conversational platform that empowers users to quickly and efficiently create full-stack Flutter applications integrated seamlessly with Firebase backend services. Ideal for solo founders, startups, and agile engineering teams, Vibe Studio allows users to visually manage and deploy Flutter apps, greatly accelerating the development process. The intuitive conversational interface simplifies complex development tasks, making app creation accessible even for non-coders.
Conclusion
Rive and Flutter together provide a streamlined workflow for adding high-quality, interactive animations to mobile apps. By designing in Rive, exporting .riv assets, and leveraging Flutter’s integration APIs, developers can deliver engaging user experiences without sacrificing performance. Explore Rive’s advanced features—like dynamic bone constraints and complex state machines—to create polished, responsive animations in your next mobile development project.