flutter_svga_easyplayer 0.2.1
flutter_svga_easyplayer: ^0.2.1 copied to clipboard
Play SVGA animations in Flutter with one widget: disk and memory caching, precaching, sound, typed errors and loading states built in.
Changelog #
All notable changes to this project will be documented in this file.
0.2.1 - 2026-11-23 #
Fixed #
- Masks (
matteKey) are applied. A sprite whose image key ends in.matteis a mask and is no longer drawn on its own; sprites next to each other that name the same mask are drawn in a layer of their own and cut to the mask's shape and opacity, as SVGAPlayer-Web does. A run is skipped on frames where its mask is fully transparent. - Sprites with an empty image key have their vector shapes drawn, as in SVGAPlayer-Web. They were skipped before.
0.2.0 - 2026-10-05 #
Clearer names for SVGAEasyPlayer. Existing code keeps working; the old
names are deprecated and point at their replacements.
Added #
SVGAEasyPlayer.network(url)andSVGAEasyPlayer.asset(path).playCount: how many times to play.- With the new constructors, giving
onFinishedmakes the animation play once (orplayCounttimes) and then call it. Without either, it repeats forever. The original constructor behaves as before. mutedonSVGAEasyPlayerandSVGAAnimationController.keepLastFrame: keep the last frame on screen when playback finishes.
Deprecated #
resUrlandassetsName: use the named constructors.loops: useplayCount, which isloops + 1.isMute: usemuted.clearsAfterStop: usekeepLastFrame, which is the opposite.
0.1.0 - 2026-10-05 #
The package has been rewritten from the ground up. Rendering is unchanged: 173 frames from 15 files were compared pixel for pixel with 0.0.7 and are identical.
Added #
- Typed errors. Every failure is an
SVGAException:SVGANetworkException(withstatusCode),SVGATimeoutException,SVGAFormatExceptionandSVGAAssetException. - Loading and error states on
SVGAEasyPlayer:placeholder,errorBuilder,onLoadedandonError. SVGAMemoryCache. Players showing the same source share one decoded animation, and it stays warm after the last player is removed.- Volume control:
volumeonSVGAEasyPlayerandSVGAAnimationController, alongsideisMute. headers,timeout,filterQuality,allowDrawingOverflowandclearsAfterStoponSVGAEasyPlayer.useCache,headersandtimeoutonSVGAParser.decodeFromURL;bundleandpackageondecodeFromAssets.SVGAParser.httpClient,SVGAParser.defaultTimeout(30 s) andSVGAParser.isolateThreshold.
Changed #
- Own SVGA reader. The file format is decoded by the package itself; the
protobufandpath_drawingdependencies are gone.MovieEntityand its parts are now plain Dart classes. - Faster. On the example gifts, decoding is up to 5× faster and painting a frame up to 5.5× faster than 0.0.7, and no file is slower (see the README). Files of 64 KB or more decode on a background isolate, and the canvas repaints only when the frame changes rather than on every display refresh.
- Disk cache rewritten. Atomic writes, an in-memory index instead of a directory scan on every write, and least-recently-used eviction.
- Assets are read straight from the bundle and are no longer copied into
the disk cache.
precacheAssetsnow only validates the assets. - Sound restarts with each loop and is written to disk when the animation loads rather than when it first plays.
Fixed #
- Two animations that used the same audio key for different sounds could play each other's sound.
SVGAEasyPlayer(useCache: false)could leave the global cache switched off for the whole app.SVGACache.clear()andgetCacheSize()did nothing until the cache had been read or written once.- A truncated download could be cached and played as a broken animation; files are now verified against their checksum.
- A non-2xx response surfaced as a zlib "Filter error".
SVGAPrecacheResult.cancelledwas alwaysfalse, andcancel()was ignored during the start delay.- A slow earlier load could overwrite a newer one after the source changed.
- A blank frame could flash between loops.
- Audio players of a replaced animation were never released.
- A missing audio plugin or an undecodable sound no longer breaks playback.
Removed #
- The separate cache, playback and quick-reference guides; the README now covers them.
- The old sample animations. The example app is now a gallery of gift animations.
Migration #
See "Migrating from 0.0.x" in the README. Typical widget code needs no changes.
0.0.7 - 2026-04-21 #
🩹 Fixes #
- Cache-poisoning hardening: The parser now caches raw bytes only
after a successful decode, and if a cached entry fails to decode (e.g.
a previously poisoned entry) it is automatically evicted and re-fetched
once. This eliminates the recurring
Exception caught by SVGAEasyPlayer: Filter error, bad datalog that could appear when a CDN momentarily served a non-SVGA payload (HTML error page with 200 status, truncated file, redirect, etc.). - Precache payload validation:
SVGAPrecacheManagerverifies the zlib magic byte of each downloaded/loaded payload before writing to the cache. Bad responses are counted asfailedand never stored.
✅ Compatibility #
- Fully backward compatible. No public API changes.
0.0.6 - 2026-04-21 #
✨ New Features #
- Silent Precaching (
SVGAPrecacheManager): Pre-fetch a list of SVGA URLs or asset paths into the persistent cache at app startup so playback starts instantly the first time a user opens a screen that uses them.- Fire-and-forget API:
SVGAPrecacheManager.shared.precache([...]) - Optional
delayso precaching does not contend with startup traffic. - Configurable
concurrency(default 3) with per-URL deduplication. - Optional per-request
timeoutand per-entryonProgresscallback. skipIfCachedavoids re-downloading valid cache entries.cancel()stops further work without interrupting the player.
- Fire-and-forget API:
SVGACache.contains(source): Cheap async lookup to check whether a valid (non-expired) cache entry exists for a given URL orassets:key.
🛠 Improvements #
- Bumped
archiveto^4.0.9,audioplayersto^6.6.0, andlintsto^6.1.0inpubspec.yaml.
✅ Compatibility #
- Fully backward compatible. Existing
SVGAEasyPlayer,SVGAParser, andSVGACacheAPIs behave exactly as before — precaching just populates the same cache the parser already reads from on playback.
0.0.5 2025-12-3 #
🛠 Version Bump #
- Bumped version to 0.0.5
- Maintenance release, no breaking changes
- Updated dependencies in
pubspec.yaml
0.0.4 - 2025-12-03 #
🛠 Fixes & Improvements #
- Protobuf Compatibility: Fixed compatibility issues with
protobuf^6.0.0. - Audio Control: Added
isMuteproperty toSVGAEasyPlayerandSVGAAnimationControllerto allow muting audio. - Lint Fixes: Resolved analysis warnings in generated files.
0.0.3 - 2025-11-23 #
🛠 Version Bump #
- Bumped version to 0.0.3
- Maintenance release, no breaking changes
- Updated dependencies in
pubspec.yaml
0.0.2 - 2025-11-10 #
🛠 Version Bump #
- Bumped version to 0.0.2
- Maintenance release, no breaking changes
- Updated dependencies in
pubspec.yaml
0.0.1 - 2025-11-09 #
🎉 Initial Release #
This is the initial release of flutter_svga_easyplayer - a powerful Flutter package for rendering SVGA animations with advanced features.
✨ Features #
SVGAEasyPlayer Widget
- Simple API: Load and play SVGA animations with minimal code
- Multiple Sources: Support for both assets and network URLs
- Automatic Resource Management: Built-in controller and lifecycle handling
Playback Control
- Infinite Loop: Default continuous playback for loading indicators and backgrounds
- Play Once: Single playback with completion callback for splash screens and one-time animations
- Repeat N Times: Controlled repetition with completion callback for celebrations and notifications
- onFinished Callback: Execute code when animations complete
Cache System
- Global Cache: Intelligent caching system for better performance
- Per-Widget Control: Enable/disable caching on individual players
- Auto-Cleanup: Automatic cache removal on widget disposal
- Storage Management: Configurable cache size and expiration
Advanced Features
- Dynamic Content: Replace text, images, and add custom drawings
- Audio Playback: Integrated audio support within animations
- Performance Optimized: Efficient rendering and memory management
- Flexible Layout: BoxFit support for responsive designs
� Documentation #
- Comprehensive README with quick start guide
- Detailed playback modes documentation
- Cache control guide
- Quick reference cheat sheet
- Interactive example applications
🎮 Examples #
- Playback modes demonstration
- Cache control examples
- Global cache management
- Dynamic content samples
�️ Technical #
- Flutter SDK: >=3.8.1
- Dart SDK: >=3.0.0
- Platform Support: Android, iOS, Desktop, Web
- Dependencies: archive, http, protobuf, audioplayers, path_provider, crypto