Skip to content

feat: add errorBuilder to the generated SvgGenImage.svg() - #788

Open
yonggipo wants to merge 1 commit into
FlutterGen:mainfrom
yonggipo:feat/svg-error-builder
Open

yonggipo wants to merge 1 commit into
FlutterGen:mainfrom
yonggipo:feat/svg-error-builder

Conversation

@yonggipo

Copy link
Copy Markdown

What does this change?

Adds an errorBuilder parameter to the generated SvgGenImage.svg() and forwards it to SvgPicture.

SvgPicture.errorBuilder is only available since flutter_svg 2.0.17, so SvgIntegration now receives the resolved flutter_svg version and version constraint (like RiveIntegration) and generates the parameter only when 2.0.17 or later is allowed:

  • resolved version from pubspec.lock is checked first
  • otherwise the version constraint from pubspec.yaml is checked
  • without any version information, the latest behavior (with errorBuilder) is used

Projects on flutter_svg < 2.0.17 get the same output as before.

Fixes #787 🎯

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist:

  • Make sure to open a GitHub issue as a bug/feature request before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
    • Ensure the tests (melos run test)
    • Ensure the analyzer and formatter pass (melos run format to automatically apply formatting)
  • Appropriate docs were updated (if necessary)

Regenerated test_resources/actual_data (melos run gen:actual_data) and the examples (melos run gen:examples:command); each generated file only gains the two errorBuilder lines. Added tests for version, constraint, priority and fallback resolution.

🤖 Generated with Claude Code

SvgPicture.errorBuilder is available since flutter_svg 2.0.17,
so the parameter is generated only when the resolved flutter_svg
version (or version constraint) allows 2.0.17 or later.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FR]: Support errorBuilder in the generated SvgGenImage.svg()

1 participant