Skip to content

[vector_graphics] Fix deprecation lints - #12702

Merged
auto-submit[bot] merged 3 commits into
flutter:mainfrom
ValentinVignal:vector_graphics/Fix-deprecation-lints
Sep 1, 2026
Merged

[vector_graphics] Fix deprecation lints#12702
auto-submit[bot] merged 3 commits into
flutter:mainfrom
ValentinVignal:vector_graphics/Fix-deprecation-lints

Conversation

@ValentinVignal

Copy link
Copy Markdown
Contributor

Part of flutter/flutter#178120

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.

Footnotes

  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. 2

@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Aug 31, 2026
@flutter-dashboard

Copy link
Copy Markdown

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

@github-actions github-actions Bot added p: vector_graphics triage-engine Should be looked at in engine triage labels Aug 31, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates vector_graphics.dart to address deprecation lints by replacing translate and scale with translateByDouble and scaledByDouble, and corrects a typo in a comment. The reviewer suggests simplifying the new matrix transformation calls by omitting optional arguments that match their default values.

Comment on lines +497 to +498
..translateByDouble(pictureInfo.size.width, 0, 0, 1)
..scaledByDouble(-1, 1, -1, 1),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The optional arguments for translateByDouble and scaledByDouble can be omitted because they match their default values (y = 0.0, z = 0.0, w = 1.0 for translateByDouble, and w = 1.0 for scaledByDouble). Simplifying these calls improves code readability.

Note that since this is a 2D graphic, scaling the Z-axis is also unnecessary, so ..scaledByDouble(-1, 1) could also be used.

Suggested change
..translateByDouble(pictureInfo.size.width, 0, 0, 1)
..scaledByDouble(-1, 1, -1, 1),
..translateByDouble(pictureInfo.size.width)
..scaledByDouble(-1, 1, -1)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not true, those methods require 4 arguments

@ValentinVignal

Copy link
Copy Markdown
Contributor Author

I would think this is a situation where we cannot write tests and the existing ones are used to catch regressions?

Also, I added an entry ## NEXT in the changelog. Does it need a new version in itself? Or maybe it shouldn't appear in the changelog at all?

What do you think?

@gaaclarke
gaaclarke requested a review from andywolff August 31, 2026 20:27
..translate(pictureInfo.size.width)
..scale(-1.0, 1.0),
..translateByDouble(pictureInfo.size.width, 0, 0, 1)
..scaledByDouble(-1, 1, -1, 1),

@andywolff andywolff Aug 31, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks the tests. Please use scaleByDouble here, not scale(d)ByDouble. scaleByDouble mutates the subject whereas scaledByDouble returns a new matrix, which is ignored in this case. PR looks good otherwise

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch, and sorry about that. I fixed it in Use scaleByDouble instead of scaledByDouble

@andywolff

Copy link
Copy Markdown

Oh also, to respond to your question explicitly:

I would think this is a situation where we cannot write tests and the existing ones are used to catch regressions?

Yes, existing tests cover this case. They even broke and identified the problem in my other comment. See "Dashboard Checks". Specifically, vector_graphics_test.dart: Respects text direction was broken

Also, I added an entry ## NEXT in the changelog. Does it need a new version in itself? Or maybe it shouldn't appear in the changelog at all?

What do you think?

I think ## NEXT is appropriate here

@andywolff andywolff added the override: no versioning needed Override the check requiring version bumps for most changes label Sep 1, 2026

@andywolff andywolff left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM

@andywolff andywolff added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 1, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Sep 1, 2026
@auto-submit

auto-submit Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/packages/12702, because - The status or check suite Dashboard Checks has failed. Please fix the issues identified (or deflake) before re-applying this label.

@andywolff andywolff added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 1, 2026
@auto-submit
auto-submit Bot merged commit 2e33644 into flutter:main Sep 1, 2026
11 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App CICD Run CI/CD override: no versioning needed Override the check requiring version bumps for most changes p: vector_graphics triage-engine Should be looked at in engine triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants