flame icon indicating copy to clipboard operation
flame copied to clipboard

Docs: two code snippets that do not compile

Open meliharik opened this issue 4 months ago • 0 comments

Following the "Documentation & Miscellaneous" step in CONTRIBUTING (file an issue first), here are two documentation snippets that do not compile as written. Happy to send a PR for both.

1. packages/flame_kenney_xml/README.md — wrong parameter names, unterminated string

final spritesheet = await XmlSpriteSheet.load(
  image: 'spritesheet.png',
  xml: 'spritesheet.xml`,
);

Three problems in four lines:

  • image: and xml: are not parameters of XmlSpriteSheet.load. lib/flame_kenney_xml.dart:34 declares imagePath: and xmlPath:, and the package's own example/lib/main.dart:26-27 and test/flame_kenney_xml_test.dart:60-61 both use those names.
  • 'spritesheet.xml`` ends with a backtick instead of a closing '`, so the string is unterminated and the block does not parse.
  • Two lines above, the prose says to place spritesheet.json in assets/. This is the XML package — load reads the file through assetsCache.readFile as XML, so it should say spritesheet.xml.

2. doc/flame/rendering/decorators.md:118 — missing closing paren

final decorator = PaintDecorator.tint(const Color(0xAAFF0000);

PaintDecorator.tint(Color color) is declared at packages/flame/lib/src/rendering/paint_decorator.dart:19; the line needs one more ) before the ;.

How I found them

I extracted every fenced code block in the repo's docs and checked paren/bracket balance outside strings and comments, then cross-checked the flagged snippets against the actual declarations in lib/. I did not include a third hit in packages/flame/CHANGELOG.md:523, since changelog entries are historical records and probably should not be edited.

meliharik avatar Jul 21 '26 05:07 meliharik