适配 Flutter 3.38+:使用官方 AssetManifest API 替换已移除的 json#475
Merged
Cateners merged 1 commit intoCateners:masterfrom Jan 7, 2026
Merged
适配 Flutter 3.38+:使用官方 AssetManifest API 替换已移除的 json#475Cateners merged 1 commit intoCateners:masterfrom
Cateners merged 1 commit intoCateners:masterfrom
Conversation
Refactor asset loading to use AssetManifest API for better performance and clarity.
Contributor
Author
|
Solve #454 |
Owner
|
非常感谢!!! |
Cateners
added a commit
that referenced
this pull request
Feb 6, 2026
适配 Flutter 3.38+:使用官方 AssetManifest API 替换已移除的 json
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.
从 Flutter 3.38.0 开始,构建产物中不再生成 AssetManifest.json 文件了(官方已切换到更高效的 AssetManifest.bin 格式)。
详情见:
发布笔记:https://docs.flutter.dev/release/release-notes/release-notes-3.38.0
Breaking change:https://docs.flutter.dev/release/breaking-changes/asset-manifest-dot-json
原来代码通过手动读取 AssetManifest.json 来获取 assets/xa* 分卷文件,在新版 Flutter 下可能会运行出错。
这次修改把这部分换成了 Flutter 官方推荐的方式:
使用 AssetManifest.loadFromAssetBundle(rootBundle).listAssets() 来获取资产列表。