feat: Removing prefix from asset loaders - #4015
Draft
erickzanardo wants to merge 1 commit into
Draft
Conversation
erickzanardo
marked this pull request as draft
August 20, 2026 13:27
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.
Description
Remove the asset-loading prefix
Images and AssetsCache silently rewrote every path they were given. Images prepended assets/images/, AssetsCache prepended assets/, both configurable via a prefix property. The path you wrote was not the path that got loaded, and the cache key was a third string again.
Every Flame asset API now takes the full bundle path, exactly as declared in pubspec.yaml, and that same string is the cache key. Nothing is ever prepended.
Breaking change on the v2.0.0 train. No deprecation period, full migration guide included.
What changed
flame. prefix deleted from both caches. Path building happens once in a shared resolver, which collapsed the duplicated key and prefix ternaries in AssetsCache. loadAllImages and loadAllFromPattern now take a required directory instead of using the prefix as both manifest filter and key strip.
flame_texturepacker. Most of this package's path arithmetic existed only to undo the prefix, reading assetsCache.prefix and img.prefix back out to strip them off resolved paths. assetsPrefix is gone and resolvePath became dead code. texture_packer_parser.dart lost 73 lines.
flame_tiled. prefix removed from TiledComponent.load, RenderableTiledMap.fromFile/fromString, and FlameTsxProvider.parse. Map file names are full paths and the "no path separators" assert is gone. Tileset and image-layer sources resolve against a new imagesDirectory argument defaulting to assets/images/, so resolution behavior is unchanged.
flame_audio. Global AudioCache built with an empty prefix. FlameAudio.updatePrefix removed, along with the save-restore-prefix hack in Bgm.play.
flame_sprite_fusion. tilemapPrefix removed. mapJsonFile and spriteSheetFile are full paths.
Checklist
docsand added dartdoc comments with///.examplesordocs.Breaking Change?
Related Issues