Skip to content

Conversation

@stuartmorgan-g
Copy link
Collaborator

The file_selector_linux example was using some methods that have been deprecated in favor of param-object versions. This updates to use those new versions.

The `file_selector_linux` example was using some methods that have been
deprecated in favor of param-object versions. This updates to use those
new versions.
@stuartmorgan-g stuartmorgan-g added the override: no changelog needed Override the check requiring CHANGELOG updates for most changes label Dec 1, 2025
@flutter-dashboard
Copy link

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.

@stuartmorgan-g
Copy link
Collaborator Author

test-exempt: code refactor with no semantic change

Copy link

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

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 two example files in file_selector_linux to replace deprecated method calls (getDirectoryPath and getDirectoryPaths) with their ...WithOptions counterparts (getDirectoryPathWithOptions and getDirectoryPathsWithOptions). My review includes suggestions to improve code conciseness by inlining a constant in both modified files, in line with Dart's style guide.

Comment on lines 15 to +19
const confirmButtonText = 'Choose';
final String? directoryPath = await FileSelectorPlatform.instance
.getDirectoryPath(confirmButtonText: confirmButtonText);
.getDirectoryPathWithOptions(
const FileDialogOptions(confirmButtonText: confirmButtonText),
);

Choose a reason for hiding this comment

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

medium

For conciseness, you can inline the confirmButtonText constant directly into the FileDialogOptions constructor. This avoids creating a local variable that is only used once, which is a general recommendation in the Dart style guide.1

Suggested change
const confirmButtonText = 'Choose';
final String? directoryPath = await FileSelectorPlatform.instance
.getDirectoryPath(confirmButtonText: confirmButtonText);
.getDirectoryPathWithOptions(
const FileDialogOptions(confirmButtonText: confirmButtonText),
);
final String? directoryPath = await FileSelectorPlatform.instance
.getDirectoryPathWithOptions(
const FileDialogOptions(confirmButtonText: 'Choose'),
);

Style Guide References

Footnotes

  1. The repository style guide states that code should follow the relevant style guides for each language. For Dart, this includes following 'Effective Dart' guidelines, which recommend avoiding local variables that are used only once.

Comment on lines 15 to +19
const confirmButtonText = 'Choose';
final List<String> directoryPaths = await FileSelectorPlatform.instance
.getDirectoryPaths(confirmButtonText: confirmButtonText);
.getDirectoryPathsWithOptions(
const FileDialogOptions(confirmButtonText: confirmButtonText),
);

Choose a reason for hiding this comment

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

medium

For conciseness, you can inline the confirmButtonText constant directly into the FileDialogOptions constructor. This avoids creating a local variable that is only used once, which is a general recommendation in the Dart style guide.1

Suggested change
const confirmButtonText = 'Choose';
final List<String> directoryPaths = await FileSelectorPlatform.instance
.getDirectoryPaths(confirmButtonText: confirmButtonText);
.getDirectoryPathsWithOptions(
const FileDialogOptions(confirmButtonText: confirmButtonText),
);
final List<String> directoryPaths = await FileSelectorPlatform.instance
.getDirectoryPathsWithOptions(
const FileDialogOptions(confirmButtonText: 'Choose'),
);

Style Guide References

Footnotes

  1. The repository style guide states that code should follow the relevant style guides for each language. For Dart, this includes following 'Effective Dart' guidelines, which recommend avoiding local variables that are used only once.

Copy link
Contributor

@robert-ancell robert-ancell left a comment

Choose a reason for hiding this comment

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

LGTM

@stuartmorgan-g stuartmorgan-g added the autosubmit Merge PR when tree becomes green via auto submit App label Dec 10, 2025
@auto-submit auto-submit bot merged commit 72f24a7 into flutter:main Dec 10, 2025
80 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 11, 2025
github-merge-queue bot pushed a commit to flutter/flutter that referenced this pull request Dec 11, 2025
flutter/packages@74a5a53...36383d6

2025-12-10 engine-flutter-autoroll@skia.org Manual roll Flutter from
6a1f5b7 to e25d71b (30 revisions) (flutter/packages#10601)
2025-12-10 arin.abdul99@gmail.com [go_router] Fixes an issue where
`onEnter` blocking causes navigation stack loss (stale state
restoration) (flutter/packages#10476)
2025-12-10 stuartmorgan@google.com [file_selector] Update Linux example
for deprecations (flutter/packages#10542)
2025-12-10 engine-flutter-autoroll@skia.org Manual roll Flutter from
b2de367 to 6a1f5b7 (22 revisions) (flutter/packages#10593)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC flutter-ecosystem@google.com on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
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 override: no changelog needed Override the check requiring CHANGELOG updates for most changes p: file_selector platform-linux

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants