Skip to content

RiveAnimation.asset(...) and RiveAnimation.network(...) won't update after calling setState() #247

@Ashkan-Sarlak

Description

@Ashkan-Sarlak

Description

RiveAnimation.asset(...) and RiveAnimation.network(...) won't update after calling setState(). It keeps on showing the previous animation, though using "Flutter Inspector" you can see name of the next asset in the Widget's state properties.

Steps To Reproduce

For an easy to produce demonstration:

  1. Create a new Flutter project
  2. Put some "riv" assets in assets directory, with names like anim_1.riv , anim_2.riv , etc.
  3. Replace the Text that shows _counter with:
    RiveAnimation.asset( 'assets/anim_${_counter % 3 + 1}.riv', )
  4. Run the program
  5. Tap the "Add" button
  6. Animation doesn't change

Expected behavior

Simply, I would like to see the next animation.
If the aforementioned behavior is intended (though I have not seen any other Widget like this), what is the most straightforward way for achieving the expected result.

Device & Versions

  • Device: iOS Simulator
  • OS: iOS 15.5
  • Flutter Version:
Flutter 3.0.4 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 85684f9300 (2 weeks ago) • 2022-06-30 13:22:47 -0700
Engine • revision 6ba2af10bb
Tools • Dart 2.17.5 • DevTools 2.12.2

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