Techniques and considerations to cache a Rive File in Flutter.
RiveAnimation
widget mentioned throughout the runtime help docs. However, there are cases where you may want to set up animation or state machine controllers associated with the Rive widget before the Artboard is rendered. Check out below for other ways to integrate Rive into your Flutter applications:
.riv
file from the rootBundle
, you’ll need to import the data yourself. The main pattern here is:
Load in the bytes of the `.riv` file
Use the `RiveFile` class to parse the data and get a reference to the file
Create a reference to the Artboard you want to display, from that file
(Optional) Associate controllers to an Artboard (i.e `StateMachineController`)
Render the `Rive` widget with the artboard reference
Load in the bytes from .riv
Use RiveFile to parse bytes
Create an Artboard reference
Associate controllers to an Artboard
Render the Rive widget
Rive
widget, you will need to call .instance()
on it. This will allow any nested artboards to render within the canvas space appropriately