2d-inc / Flare-Flutter

Load and get full control of your Rive files in a Flutter project using this library.
https://rive.app/
MIT License
2.55k stars 469 forks source link

Can't load FlareActor.bundle on Android #311

Closed nizwar closed 2 years ago

nizwar commented 2 years ago

I've store all my animation on getTemporaryDirectory (because its downloaded from server), so i write something like this

 FlareActor.bundle(
     filename,
     bundle: rootBundle,  
     controller: this, 
)

//also this
await actor.loadFromBundle(rootBundle, filename);

The animation didn't load, on loadFromBundle it return "Unable to load asset : PATH" Its working fine on IOS, please let me know how to get through this

thanks in advance!

luigi-rosso commented 2 years ago

Do you have any spaces in your file path? I've noticed that Android sometimes has trouble with this.

nizwar commented 2 years ago

Yeah its happened with Android, Flare bundle and asset only work with internal resources, you can't really access flare file outside

but at this moment here is my simple way to get through this

 return FutureBuilder<Uint8List>(
    future: widget.provider.getMemory(File(fileSnapshot.data)),
    builder: (context, readSnapshot) {
        if (!readSnapshot.hasData) return SizedBox.shrink();
        return FlareActor.memory(
                readSnapshot.data,
                // AssetFlare(bundle: PlatformAssetBundle(), name: snapshot.data.path),
                alignment: Alignment.bottomCenter,
                controller: this,
                fit: BoxFit.cover,
                callback: (r) {},
       );
   },
);