rive-flutter
rive-flutter copied to clipboard
Add `package` parameter to `RiveAnimation.asset()` for package support
Problem
RiveAnimation.asset() doesn't support a package parameter, preventing Rive animations from being stored in reusable packages shared across projects.
Proposed Solution
Add a package parameter to match Flutter's convention:
RiveAnimation.asset(
'animations/my_animation.riv',
package: 'my_package',
)
Context
This pattern is standard across Flutter's asset APIs:
// Image
Image.asset('path', package: 'my_package')
// SvgPicture
SvgPicture.asset('path', package: 'my_package')
Benefit
Enables sharing Rive animations across multiple projects via packages, improving code reusability.
Note
I know that you’re deprecating RiveAnimation.asset() in version 0.14. In v0.14, it will look something like this:
late final fileLoader = FileLoader.fromAsset(
'animations/my_animation.riv',
riveFactory: Factory.rive,
package: 'my_package'
);