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

cachedActor example is no longer working #224

Closed
tsinis opened this issue Jan 17, 2020 · 3 comments
Closed

cachedActor example is no longer working #224

tsinis opened this issue Jan 17, 2020 · 3 comments

Comments

@tsinis
Copy link

tsinis commented Jan 17, 2020

Hello!

Dear Rive Team, first and foremost, thank you very much for this amazing tool, it is unprecedented. There is an issue with cachedActor function, it's not working anymore in flare_flutter 2.0.1, like in your example code:
https://github.com/2d-inc/developer_quest/blob/8a7ef09687309c4f48ef040c091fbb44e7b1b909/lib/src/widgets/flare/warmup_flare.dart#L30

Could you please provide updated example of animation caching? Thank you, one more time!

@umberto-sonnino
Copy link
Contributor

Hi @tsinis thanks for the support!
I've just run our basic example and it seems to be working here..!

Is there some case in particular that's failing for you?

@tsinis
Copy link
Author

tsinis commented Jan 17, 2020

Hi @tsinis thanks for the support!
I've just run our basic example and it seems to be working here..!

Is there some case in particular that's failing for you?

Hey @umberto-sonnino

Thanks for your reply! Sadly, your basic example does not using cachedActor function. I'm talking about that specific case mentoed by @luigi-rosso.
It is used in your developer_quest app (i've linked in first message). It have to cache animation in main.dart before app loaded completely, but It does not work anymore. It's also mentoed in your loading strategies, which apparently needs to be updated...

Function does not takes two arguments, but only one "AssetProvider" (since flare_flutter v2+), but there is no much documentation to that. How can we cache our animations on app launch, before first runApp() run?

@tsinis
Copy link
Author

tsinis commented Jan 20, 2020

Hi @umberto-sonnino!

I'm closing Issue, since I have figured out how to do it.
Old way mentoed in documentation, Loading strategies:

const _filesToWarmup = [
  "assets/file.flr",
];

Future<void> warmupFlare() async {
  for (final filename in _filesToWarmup) {
    await cachedActor(rootBundle, filename);
  }
}

New way, since package version 2.0+

import 'package:flare_flutter/asset_provider.dart';
import 'package:flare_flutter/provider/asset_flare.dart';

final AssetProvider assetProvider = AssetFlare(bundle: rootBundle, name: 'assets/file.flr');

Future<void> _warmupAnimations() async {
await cachedActor(assetProvider);
}

Please update documentation. Thanks in advance and see you in Warsaw on Friday!

@tsinis tsinis closed this as completed Jan 20, 2020
miguelpruivo added a commit to miguelpruivo/Flare-Flutter that referenced this issue Mar 3, 2020
Updated example accordingly to 2d-inc#224.

Thank you @tsinis for coming up with the solution.
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

No branches or pull requests

2 participants