Version 0.14.0
This is a significant update for Rive Flutter. We’ve completely removed all of the Dart code that was used for the Rive runtime and replaced it with our underlying C++ Runtime. See the Rive Native for Flutter page for more details. This has resulted in a numbers of changes to the underlying API, and a large portion of the code base that was previously accessible through Dart is now implemented in C++ through FFI.What’s New in 0.14.0
This release of Rive Flutter adds support for:- Rive Renderer
- Data Binding
- Layouts
- Scrolling
- N-Slicing
- Vector Feathering
- All other features added to Rive that did not make it to the previous versions of Rive Flutter
- Includes the latest fixes and improvements for the Rive C++ runtime
- Adds prebuilt libraries, with the ability to build manually. See the rive_native package for more information
- Removes the
rive_commonpackage and replaces it withrive_native
All your Rive graphics will still look and function the same as they did before.
Requirements
Dart and Flutter Versions
This release bumps to these versions:Required Setup
Important: You must callRiveNative.init at the start of your app, or before you use Rive. For example, in main.dart:
Migration Guide
Quick Migration Checklist
- ✅ Update your
pubspec.yamldependencies to use version0.14.0or later - ✅ Add
RiveNative.init()to yourmain()function, or call before using Rive. - ✅ Replace
RiveandRiveAnimationwidgets withRiveWidgetorRiveWidgetBuilder - ✅ Update your controllers to use the new API, see
RiveWidgetController - ✅ Review and update any custom asset loading code
- ✅ Test your graphics and interactions
Removed Classes
The following classes have been completely removed:RiveandRiveAnimationwidgets → UseRiveWidgetandRiveWidgetBuilderRiveAnimationControllerand its subclasses → UseRiveWidgetController,SingleAnimationPainter, andStateMachinePainterOneShotAnimationandSimpleAnimation→ UseSingleAnimationPainterto play individual animationsStateMachineController→ UseStateMachineinstead (can be accessed viaRiveWidgetController.stateMachine)RiveEvent→ Replaced withEventSMITrigger→ Replaced withTriggerInputSMIBool→ Replaced withBooleanInputSMINumber→ Replaced withNumberInputFileAssetLoader→ Replaced with optional callback when creating aFile
Loading Rive Files
RiveFile has been removed and replaced with File. Important changes:
- New API
- Old API
New API
Factory determines the renderer that will be used. Use Factory.rive for the Rive renderer or Factory.flutter for the shipped Flutter renderer (Skia or Impeller).
Key Changes:
- Creating a Rive File now requires a factory (
Factory.riveorFactory.flutter) - Replace
RiveFile.importwithFile.decode()which returns aFuture<File> - Replace
mainArtboardwithdefaultArtboard() - Replace
artboardByName(name)withartboard(name) - Replace
RiveFile.networkwithFile.url - Replace
RiveFile.filewithFile.path
Widget Migration
See the updated example app for a complete migration guide, including how to use the newRiveWidget and RiveWidgetBuilder APIs.
| Old Widget | New Widget | Notes |
|---|---|---|
Rive/RiveAnimation | RiveWidget/RiveWidgetBuilder | Direct replacement |
- New API - Option 1
- New API - Option 2
- Old API
Using RiveWidgetBuilder
Controller Migration
| Old Controller | New Controller | Notes |
|---|---|---|
RiveAnimationController | RiveWidgetController | Main controller for widgets |
StateMachineController | StateMachine | Direct state machine access |
OneShotAnimation and SimpleAnimation | SingleAnimationPainter | For individual animations |
RiveWidgetController:
Using RiveWidgetController
Specifying Artboard and State Machine
Handling State Machine Inputs
StateMachineController has been removed and replaced with StateMachine. Important changes:
- New API
- Old API
State Machine Inputs: New API
stateMachine from the RiveWidgetController:
It is recommended to manually dispose inputs when no longer needed:
input.dispose()Nested Inputs
You can access nested inputs by providing an optionalpath parameter:
Nested Inputs
Handling Rive Events
RiveEvent has been removed and replaced with Event. Event is a sealed class with two options:
OpenUrlEventGeneralEvent
- New API
- Old API
Rive Events: New API
properties returns Map<String, CustomProperty>. CustomProperty is also a sealed class with options:
CustomNumberPropertyCustomBooleanPropertyCustomStringProperty
value field. On the Event class, there are convenient accessors:
Layout Changes
BoxFit → Fit
Previously we used Flutter’sBoxFit class. Now we use our own Fit which includes an extra option:
Asset Loading Changes
TheFileAssetLoader class and all its subclasses have been removed:
CDNAssetLoaderLocalAssetLoaderCallbackAssetLoaderFallbackAssetLoader
Out-of-band Asset Loading
- New API
- Old API
Out-of-band Asset Loading: New API
assetLoadercan no longer be an asynchronous lambdaImageAsset.parseBytes(bytes)→riveFactory.decodeImage(bytes)orasset.decode(bytes)FontAsset.parseBytes(bytes)→riveFactory.decodeFont(bytes)orasset.decode(bytes)AudioAsset.parseBytes(bytes)→riveFactory.decodeAudio(bytes)orasset.decode(bytes)ImageAsset.image = value→ImageAsset.renderImage(value)(returns boolean)FontAsset.font = value→FontAsset.font(value)(returns boolean)AudioAsset.audio = value→AudioAsset.audio(value)(returns boolean)
Text Run Updates
It’s no longer possible to access aTextValueRun object directly. Use these methods instead to access the String value:
Get/Set Text Run Value
Known Missing Features
These features are not available inv0.14.0 but may be added in future releases:
- Automatic Rive CDN asset loading
speedMultiplieruseArtboardSizeclipRectisTouchScrollEnableddynamicLibraryHelper
Removed Code Paths
All of the “runtime” Dart code has been removed from these paths:src/controllerssrc/coresrc/generatedrive_coreutilities
Getting Help
If you encounter issues during migration:- Check the Rive Flutter documentation
- Review the Data Binding guide
- Visit the Rive community forums
- Report issues on the GitHub repository