Flare-flutter: cachedActor example is no longer working

Created on 17 Jan 2020  路  3Comments  路  Source: 2d-inc/Flare-Flutter

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!

Most helpful comment

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!

All 3 comments

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?

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?

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!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

EArminjon picture EArminjon  路  7Comments

madtocc picture madtocc  路  8Comments

kautukkundan picture kautukkundan  路  3Comments

hyeonjae picture hyeonjae  路  5Comments

izzatzr picture izzatzr  路  4Comments