Flare-Flutter icon indicating copy to clipboard operation
Flare-Flutter copied to clipboard

Specifying package string

Open MSchmack opened this issue 5 years ago • 2 comments

Image.asset allows to specify the package string, this is nessecary when writing a package and using the asset in a widget of the package. Without this information an error will be thrown when trying to retrieve the asset.

A similiar parameter is needed to use an asset in the same fashion with flareflutter

Example with the Image widget:

Image.asset(
            AssetImage("assets/img/supergraphic.png").assetName,
            package: 'flutter_ui_components',
            fit: BoxFit.fitWidth,
          ),

Recreation of the situation:

  1. Create plugin flutter create --org com.example --template=plugin hello
  2. Write Widget with FlareActor in the dart portion of the plugin
  3. Try to use the widget in the example flutter app of the plugin

MSchmack avatar Oct 10 '19 12:10 MSchmack

We'll expose both the package name and the bundle to use soon. In the meantime, could you try to see if this unblocks you: specify the .flr file's name with a preceding package path ("packages/" + packageName + "/" + flareFile):

FlareActor("packages/flutter_ui_components/assets/my_flare_file.flr")

luigi-rosso avatar Oct 16 '19 20:10 luigi-rosso

That solution worked for me

MSchmack avatar Oct 28 '19 14:10 MSchmack