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 470 forks source link

Update loading_strategies.md #240

Closed miguelpruivo closed 3 years ago

miguelpruivo commented 4 years ago

As of 2.0.1 it seems that caching strategies aren't updated. #224 purposes a valid and updated solution, so example should have it as well.

Thank you @tsinis.

tsinis commented 4 years ago

Hi!

Good job @miguelpruivo, thank you for this PR. It would be even better if there will be info about caching multiple FLR files at once (in original Loading Strategies there was a list of Strings with paths to FLR files), because ATM asset provider can only cache single String as parameter. Obviously it's not enough sometimes if there is several animations to cache... Thanks anyways.

Best regards, Roman

a7medpa commented 4 years ago

I'm quite new to all of this so bear with me.

In part 2 it suggests that you should use that branch in the pubspec. I tried checking how to add a dependency from a branch and this is what I ended up within my pubspec under dependencies: flare_flutter: git: url: git:https://github.com/2d-inc/Flare-Flutter/tree/4abf8947b16f2d45c02a34c48bd7b209fa208ce3 ref: sync_load It seems that the above is incorrect because it just hangs.

Is it possible to provide an example of this in addition to the multiple files/assets that @tsinis suggested? I have done it but I'm sure it's not the best way of doing it. Thanks in advance.

mwenechac-sys commented 4 years ago

I am trying to load multiple files. Is there an example of how I can do that?

umberto-sonnino commented 4 years ago

I am trying to load multiple files. Is there an example of how I can do that?

@mwenechac-sys there's a snippet here for warming up the cache from a List: add more to the list to load multiple before the app starts.

Bear in mind that initializing more assets before launch will slow down the app startup times, so before filling up that list, I'd recommend determining which assets truly need to be warmed-up in cache.