Skip to content

Add package parameter to RiveAnimation.asset() for package support #554

@eli1stark

Description

@eli1stark

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'
   );

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions