rive-flutter icon indicating copy to clipboard operation
rive-flutter copied to clipboard

[feature] rive cache implemented like flare cache

Open talamaska opened this issue 3 years ago • 4 comments

I believe this can be done, after all cache stores bytes and this what the RiveFile wants right? It would be nice if we can leverage root bundle and warmup rive files. I don't have metrics or example where I see loading slowness, now that we don't have rasters, the size of the same animation is 6kb vs the old one 275kb. It might come handy to preload multiple rive files.

talamaska avatar Apr 13 '21 22:04 talamaska

asset_cache will work to cache the binary riv file

fredgrott avatar May 14 '21 17:05 fredgrott

This wasn't implemented because we were lacking a core feature that prevented an efficient caching solution from working. Good news is we now have it, so a caching solution can be implemented. For reference: https://github.com/rive-app/rive-flutter/pull/109

Previously when you loaded a .riv file, the deserialized content would be modified by animations, meaning it couldn't be re-used if the file was shown in another part of the app. It would need to be reloaded from raw bytes which meant cycles would be wasted on deserialization and initialization which can be expensive on complicated files.

What that all means is that a caching solution for the raw bytes wasn't sufficient, we need to cache the deserialized file and its artboards. Then instance the artboards on demand when a part of the app needs them from the already initialized source.

We can now add Flutter caching to our roadmap, I'll keep this issue open and reference it as we make progress.

luigi-rosso avatar Jun 18 '21 16:06 luigi-rosso

asset_cache will work to cache the binary riv file

How?

ps6067966 avatar Nov 29 '21 13:11 ps6067966

Related to: https://github.com/rive-app/rive-flutter/issues/68

HayesGordon avatar Feb 01 '23 13:02 HayesGordon