Learn how to migrate your Flutter app when upgrading between major versions of the Rive Flutter runtime, including breaking changes and new features.
rive_common
package and replaces it with rive_native
RiveNative.init
at the start of your app, or before you use Rive. For example, in main.dart
:
pubspec.yaml
dependencies to use version 0.14.0
or later
RiveNative.init()
to your main()
function, or call before using Rive.Rive
and RiveAnimation
widgets with RiveWidget
or RiveWidgetBuilder
RiveWidgetController
Rive
and RiveAnimation
widgets → Use RiveWidget
and RiveWidgetBuilder
RiveAnimationController
and its subclasses → Use RiveWidgetController
, SingleAnimationPainter
, and StateMachinePainter
OneShotAnimation
and SimpleAnimation
→ Use SingleAnimationPainter
to play individual animationsStateMachineController
→ Use StateMachine
instead (can be accessed via RiveWidgetController.stateMachine
)RiveEvent
→ Replaced with Event
SMITrigger
→ Replaced with TriggerInput
SMIBool
→ Replaced with BooleanInput
SMINumber
→ Replaced with NumberInput
FileAssetLoader
→ Replaced with optional callback when creating a File
RiveFile
has been removed and replaced with File
. Important changes:
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).
Factory.rive
or Factory.flutter
)RiveFile.import
with File.decode()
which returns a Future<File>
mainArtboard
with defaultArtboard()
artboardByName(name)
with artboard(name)
RiveFile.network
with File.url
RiveFile.file
with File.path
RiveWidget
and RiveWidgetBuilder
APIs.
Old Widget | New Widget | Notes |
---|---|---|
Rive /RiveAnimation | RiveWidget /RiveWidgetBuilder | Direct replacement |
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
:
StateMachineController
has been removed and replaced with StateMachine
. Important changes:
stateMachine
from the RiveWidgetController
:
input.dispose()
path
parameter:
RiveEvent
has been removed and replaced with Event
. Event
is a sealed class with two options:
OpenUrlEvent
GeneralEvent
properties
returns Map<String, CustomProperty>
. CustomProperty
is also a sealed class with options:
CustomNumberProperty
CustomBooleanProperty
CustomStringProperty
value
field. On the Event
class, there are convenient accessors:
BoxFit
class. Now we use our own Fit
which includes an extra option:
FileAssetLoader
class and all its subclasses have been removed:
CDNAssetLoader
LocalAssetLoader
CallbackAssetLoader
FallbackAssetLoader
assetLoader
can no longer be an asynchronous lambdaImageAsset.parseBytes(bytes)
→ riveFactory.decodeImage(bytes)
or asset.decode(bytes)
FontAsset.parseBytes(bytes)
→ riveFactory.decodeFont(bytes)
or asset.decode(bytes)
AudioAsset.parseBytes(bytes)
→ riveFactory.decodeAudio(bytes)
or asset.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)TextValueRun
object directly. Use these methods instead to access the String value:
v0.14.0
but may be added in future releases:
speedMultiplier
useArtboardSize
clipRect
isTouchScrollEnabled
dynamicLibraryHelper
src/controllers
src/core
src/generated
rive_core
utilities