Skip to content

Event listener added with stateMachine.addEventListener is never called #591

@WieFel

Description

@WieFel

Description

In Rive 0.14.0, I want to get updates about state changes happening in my state machine, but the event listener is never called, although it is obvious that a state change happened in the state machine.

I tried it also in the data-binding example from the official rive examples, but the event listener is never called.
The example I tried is: https://github.com/rive-app/rive-flutter/blob/master/example/lib/examples/databinding.dart

Future<void> _init() async {
  file = await File.asset(
    'assets/rewards.riv',
    riveFactory: RiveExampleApp.getCurrentFactory,
  );
  controller = RiveWidgetController(file!);
  // --- I added this ---
  controller?.stateMachine.addEventListener(
    (event) {
      debugPrint('STATE MACHINE EVENT: $event');
    },
  );

  _initViewModel();
  setState(() {});
}

Steps To Reproduce

Steps to reproduce the behavior:

  1. Clone the rive repository https://github.com/rive-app/rive-flutter
  2. Run example/ project
  3. Open e.g. the databinding.dart file
  4. Add a state machine event listener (like above) with some print statement
  5. Run the app and open the respective page in the app
  6. See that the event listener is never called

Source .riv/.rev file

You can find the .riv files in the examples project's assets/

Expected behavior

The event listener of the state machine should obviously be called for happening events.

Device & Versions (please complete the following information)

  • Device: Android Emulator
  • OS: Android SDK API Level 34
  • Flutter Version: Copy-paste the output of flutter --version:
Flutter 3.38.5 • channel stable • https://github.com/flutter/flutter.git
Framework • revision f6ff1529fd (10 days ago) • 2025-12-11 11:50:07 -0500
Engine • hash c108a94d7a8273e112339e6c6833daa06e723a54 (revision 1527ae0ec5) (9 days ago) •
2025-12-11 15:04:31.000Z
Tools • Dart 3.10.4 • DevTools 2.51.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions