Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing flr file load failed in flutter plugin. #130

Closed
wants to merge 1 commit into from

Conversation

lionoggo
Copy link

@lionoggo lionoggo commented Jul 19, 2019

If we use Flare animation in the flutter-plugin project, an exception will be thrown that the resource failed to load, as shown below:

E/flutter (15211): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: Unable to load asset: assets/Filip.flr
E/flutter (15211): #0      PlatformAssetBundle.load (package:flutter/src/services/asset_bundle.dart:229:7)
E/flutter (15211): <asynchronous suspension>
E/flutter (15211): #1      FlareCacheAsset.load (package:flare_flutter/flare_cache_asset.dart:18:20)
E/flutter (15211): #2      Cache.getAsset (package:flare_flutter/cache.dart:55:15)
E/flutter (15211): <asynchronous suspension>

The root cause of the problem is: no package name is specified for the resource.We solve this problem by specifying a package name for the resource, as shown below:

    FlareActor(
      "assets/Filip.flr",
      alignment: Alignment.center,
      fit: BoxFit.contain,
      animation: _animationName,
      package: 'simple_plugin',
    );

At the same time, I also added a new demo project:simple-plugin.

@OOMROO
Copy link

OOMROO commented Aug 2, 2019

It's great.

@OOMROO
Copy link

OOMROO commented Aug 2, 2019

FlareActor(
"packages/pluginname/assets/Filip.flr",
alignment: Alignment.center,
fit: BoxFit.contain,
animation: _animationName,

);

it's ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants