Skip to content

Simple animation stopped on hot reload/hot restart with rive: 0.14.0-dev.6 #532

@AlexisDeslandes

Description

@AlexisDeslandes

Description

Simple animation stopped on hot reload/hot restart with rive: 0.14.0-dev.6
Am I doing something wrong with the new way of writing code?

Steps To Reproduce

Run this code:

import 'package:flutter/material.dart';
import 'package:rive/rive.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await RiveNative.init();
  runApp(const MaterialApp(home: SimpleAssetAnimation()));
}

class SimpleAssetAnimation extends StatefulWidget {
  const SimpleAssetAnimation({Key? key}) : super(key: key);

  @override
  State<SimpleAssetAnimation> createState() => _SimpleAssetAnimationState();
}

class _SimpleAssetAnimationState extends State<SimpleAssetAnimation> {
  File? file;
  RiveWidgetController? controller;
  bool isInitialized = false;

  @override
  void initState() {
    super.initState();
    initRive();
  }

  void initRive() async {
    file = await File.asset(
      'assets/timer.riv',
      riveFactory: Factory.rive,
    );
    controller = RiveWidgetController(file!);
    setState(() => isInitialized = true);
  }

  @override
  void dispose() {
    controller?.dispose();
    file?.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Simple Animation'),
      ),
      body: Center(
        child: isInitialized && controller != null
            ? RiveWidget(
                controller: controller!,
                fit: Fit.cover,
              )
            : const CircularProgressIndicator(),
      ),
    );
  }
}

Once running, it will works but as soon as you hot reload or hot restart it stopped.

Source .riv/.rev file

The .rev file :
https://drive.google.com/file/d/1ddpwZY0h6UPpAlbItByOipKgPCGthQNG/view?usp=sharing

Expected behavior

With rive: ^0.13.7
And this code, it works perfectly :

import 'package:flutter/material.dart';
import 'package:rive/rive.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(const MaterialApp(home: SimpleAssetAnimation()));
}

class SimpleAssetAnimation extends StatelessWidget {
  const SimpleAssetAnimation({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Simple Animation'),
      ),
      body: const Center(
        child: RiveAnimation.asset(
          'assets/timer.riv',
          fit: BoxFit.cover,
        ),
      ),
    );
  }
}

Device & Versions (please complete the following information)

  • Device: Web, Android et iOs simulator has the same issue
  • OS: iOS 18.6 & Android 16.0
  • Flutter Version: Copy-paste the output of flutter --version
    e.g.:
Flutter 3.35.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 20f8274939 (4 weeks ago) • 2025-08-14 10:53:09 -0700
Engine • hash 6cd51c08a88e7bbe848a762c20ad3ecb8b063c0e (revision 1e9a811bf8) (27 days ago) • 2025-08-13 23:35:25.000Z
Tools • Dart 3.9.0 • DevTools 2.48.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions