packages icon indicating copy to clipboard operation
packages copied to clipboard

[flutter_svg] Add `SvgPicture.precompiled` constructor

Open nilsreichardt opened this issue 2 months ago • 6 comments

flutter_svg allows precompiled SVG files, see Precompiling and Optimizing SVGs.

However, as a developer, you have to add three things to your code:

  1. Add vector_graphics as a direct dependency
  2. Add import 'package:vector_graphics/vector_graphics.dart'; import
  3. Use additionally the AssetBytesLoader class.

With SvgPicture.precompiled(String assetName, [...]) a developer of the package can use precompiled SVG files without the three steps above.

Closes https://github.com/flutter/flutter/issues/177068

Pre-Review Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

[^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.

nilsreichardt avatar Oct 17 '25 21:10 nilsreichardt

@domesticmouse Thanks for your quick review! Do you have feedback for the questions that I posted?

nilsreichardt avatar Oct 18 '25 17:10 nilsreichardt

PTAL @stuartmorgan-g

domesticmouse avatar Oct 18 '25 18:10 domesticmouse

PTAL @stuartmorgan-g

Since this is expanding the API surface, it should be signed off by someone from the engine team, since that's the team that has primary ownership of the package. I'll leave a comment on the issue.

stuartmorgan-g avatar Oct 24 '25 17:10 stuartmorgan-g

From triage: @chinmaygarde Are the packages in this repo owned by the engine team being included in engine team triage? (If not, the triage-engine label is an easy way to pick up all of them with one query).

stuartmorgan-g avatar Nov 18 '25 16:11 stuartmorgan-g

From triage: Ping @chinmaygarde on the question above.

stuartmorgan-g avatar Dec 02 '25 19:12 stuartmorgan-g

We recently found that the filters used for issue triage (go/flutter-engine-triage-playbook) were ignoring SVG and vector graphics issues. I think a similar fix needs to be applied for PR triage. While the label is good, we were not looking in this repo for PRs.

chinmaygarde avatar Dec 02 '25 22:12 chinmaygarde