fix(flet-lottie): local asset files not loading on Windows desktop#6426
Open
ndonkoHenri wants to merge 8 commits intorelease/v0.85.0from
Open
fix(flet-lottie): local asset files not loading on Windows desktop#6426ndonkoHenri wants to merge 8 commits intorelease/v0.85.0from
flet-lottie): local asset files not loading on Windows desktop#6426ndonkoHenri wants to merge 8 commits intorelease/v0.85.0from
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes flet-lottie failing to load local Lottie JSON files on Windows desktop by switching local (filesystem) sources to use Lottie.file(...) instead of Flutter’s asset-bundle API (Lottie.asset(...)), which expects build-time registered assets.
Changes:
- Route
AssetSource.isFileLottie sources through a newfileLottie()helper that callsLottie.file(...)on IO platforms. - Add conditional export (
file_lottie.dart) with an IO implementation and a web stub to keep web builds compiling. - Bump the Flutter
lottiedependency and add a changelog entry describing the fix.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| sdk/python/packages/flet-lottie/src/flutter/flet_lottie/pubspec.yaml | Updates lottie dependency version used by the Flutter side of flet-lottie. |
| sdk/python/packages/flet-lottie/src/flutter/flet_lottie/lib/src/lottie.dart | Switches local file loading from Lottie.asset to the new fileLottie() wrapper. |
| sdk/python/packages/flet-lottie/src/flutter/flet_lottie/lib/src/file_lottie.dart | Adds conditional export to select IO vs web implementation. |
| sdk/python/packages/flet-lottie/src/flutter/flet_lottie/lib/src/file_lottie_io.dart | Implements fileLottie() via Lottie.file(io.File(path)) for desktop/mobile. |
| sdk/python/packages/flet-lottie/src/flutter/flet_lottie/lib/src/file_lottie_web.dart | Provides a web stub (throws) to keep the package compiling on web. |
| sdk/python/packages/flet-lottie/CHANGELOG.md | Documents the fix under a new release entry. |
| client/pubspec.lock | Updates resolved dependency versions for the Flutter client workspace. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ages for web builds
Deploying flet-examples with
|
| Latest commit: |
6ead027
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://e7138d5f.flet-examples.pages.dev |
| Branch Preview URL: | https://fix-lottie.flet-examples.pages.dev |
… SharedPreferences, Clipboard, and StoragePaths
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When
src="sample.json"is passed, Flet'sgetAssetSource()resolves it to an absolute filesystem path (e.g.C:\Users\...\assets\sample.json).flet-lottiewas passing that path toLottie.asset(...), which is the Flutter asset-bundle API — it looks up keys registered inpubspec.yamlat build time, not arbitrary filesystem paths. On Windows this surfaces asUnable to load asset: "C:\...".As fix, we now route filesystem paths through
Lottie.file(io.File(path))instead, for better local file handling.Resolves #6386
Test Code
Summary by Sourcery
Route local Lottie JSON asset paths through a new file-based loader to fix desktop file loading issues and keep web builds compiling.
Bug Fixes:
Enhancements:
Documentation: