Skip to content

Conversation

@ahmedsameha1
Copy link
Contributor

@ahmedsameha1 ahmedsameha1 commented May 3, 2025

Replace [FinderBase] with [Finder] in the doc comments of Matchers.

Closes #168230

@github-actions github-actions bot added a: tests "flutter test", flutter_test, or one of our tests framework flutter/packages/flutter repository. See also f: labels. labels May 3, 2025
Copy link
Contributor

@justinmc justinmc left a comment

Choose a reason for hiding this comment

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

Isn't it more accurate to say FinderBase instead of Finder? Something like findsNothing could be used with SemanticsFinder, which is a FinderBase and not a Finder.

Edit: In your example in the issue #168230, you compare findsNothing with findsOneWidget, but findsOneWidget should operate only on Finders, so I think that is correct as-is.

@ahmedsameha1
Copy link
Contributor Author

I cannot understand you. Both FindsNothing and FindsOneWidget are instances of the same class: _FindsCountMatcher, so if something should work with one, it should work with the other, and if something should not work with one, it should not work with the other.
Ok. I could replace [Finder] with [FinderBase]. There is more than one subtype of FinderBase, so I think that you are correct that I should replace [Finder] with [FinderBase]. May I update this pull request according to this?

@justinmc
Copy link
Contributor

Yes please go ahead and update the PR and I will take another look. Thank you!

@ahmedsameha1
Copy link
Contributor Author

I did replace [Finder] with [FinderBase] in the doc comments of Matchers.

Copy link
Contributor

@justinmc justinmc left a comment

Choose a reason for hiding this comment

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

I think these are all correct as-is, unless I missed one. These all seem to operate on widgets and therefore it's more accurate to say Finder and not FinderBase.

I think we can probably close this PR and close #168230, unless there is a specific mismatch that you see in the use of Finder vs. FinderBase.

const Matcher findsNothing = _FindsCountMatcher(null, 0);

/// Asserts that the [Finder] locates at least one widget in the widget tree.
/// Asserts that the [FinderBase] locates at least one widget in the widget tree.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this was correct as-is. findsWidgets deals with widgets and so does Finder.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

findsWidgets is an instance of the _FindsCountMatcher class.
This is the signature of the matches() method of _FindsCountMatcher:

bool matches(covariant FinderBase<dynamic> finder, Map<dynamic, dynamic> matchState)

As you can see, it takes a FinderBase, not a Finder, as its first argument. So I think that FinderBase is the correct type that should be used in this doc comment.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah ok you're right, they do all operate on FinderBase even when they have "widgets" in the name. I even see this below for findsOneWidget:

This is equivalent to the preferred [findsOne] method.

Indeed findsOne and findsOneWidget are identical.

Matcher findsAtLeast(int n) => _FindsCountMatcher(n, null);

/// Asserts that the [Finder] locates a single widget that has at
/// Asserts that the [FinderBase] locates a single widget that has at
Copy link
Contributor

Choose a reason for hiding this comment

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

This one looks like it actually should be Finder right?

bool matches(covariant Finder finder, Map<dynamic, dynamic> matchState) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok. This should be Finder.

const Matcher findsNothing = _FindsCountMatcher(null, 0);

/// Asserts that the [Finder] locates at least one widget in the widget tree.
/// Asserts that the [FinderBase] locates at least one widget in the widget tree.
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah ok you're right, they do all operate on FinderBase even when they have "widgets" in the name. I even see this below for findsOneWidget:

This is equivalent to the preferred [findsOne] method.

Indeed findsOne and findsOneWidget are identical.

const Matcher isOffstage = _IsOffstage();

/// Asserts that the [Finder] locates a single widget that has no
/// Asserts that the [FinderBase] locates a single widget that has no
Copy link
Contributor

Choose a reason for hiding this comment

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

Also this one should stay Finder.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok. This should stay Finder.

const Matcher isInCard = _IsInCard();

/// Asserts that the [Finder] locates a single widget that has no
/// Asserts that the [FinderBase] locates a single widget that has no
Copy link
Contributor

Choose a reason for hiding this comment

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

Should stay Finder.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok. This should stay Finder.

Comment on lines 469 to 472
/// Asserts that a [Finder], [Future<ui.Image>], or [ui.Image] matches the
/// Asserts that a [FinderBase], [Future<ui.Image>], or [ui.Image] matches the
/// golden image file identified by [key], with an optional [version] number.
///
/// For the case of a [Finder], the [Finder] must match exactly one widget and
/// For the case of a [FinderBase], the [FinderBase] must match exactly one widget and
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like it's a Finder:

} else if (item is Finder) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok. This should stay Finder.

const Matcher clipsWithBoundingRect = _ClipsWithBoundingRect();

/// Asserts that a [Finder] locates a single object whose root RenderObject is
/// Asserts that a [FinderBase] locates a single object whose root RenderObject is
Copy link
Contributor

Choose a reason for hiding this comment

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

Finder:

bool matches(covariant Finder finder, Map<dynamic, dynamic> matchState) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok. This should stay Finder.

const Matcher hasNoImmediateClip = _MatchAnythingExceptClip();

/// Asserts that a [Finder] locates a single object whose root RenderObject
/// Asserts that a [FinderBase] locates a single object whose root RenderObject
Copy link
Contributor

Choose a reason for hiding this comment

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

Finder:

bool matches(covariant Finder finder, Map<dynamic, dynamic> matchState) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok. This should stay Finder.

}

/// Asserts that a [Finder] locates a single object whose root RenderObject
/// Asserts that a [FinderBase] locates a single object whose root RenderObject
Copy link
Contributor

Choose a reason for hiding this comment

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

Finder:

bool matches(covariant Finder finder, Map<dynamic, dynamic> matchState) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok. This should stay Finder.

}

/// Asserts that a [Finder] locates a single object whose root RenderObject
/// Asserts that a [FinderBase] locates a single object whose root RenderObject
Copy link
Contributor

Choose a reason for hiding this comment

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

Finder:

bool matches(covariant Finder finder, Map<dynamic, dynamic> matchState) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, Finder.

}

/// Asserts that a [Finder] locates a single object whose root RenderObject
/// Asserts that a [FinderBase] locates a single object whose root RenderObject
Copy link
Contributor

Choose a reason for hiding this comment

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

Finder:

bool matches(covariant Finder finder, Map<dynamic, dynamic> matchState) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, Finder.

@ahmedsameha1
Copy link
Contributor Author

I have updated the pull request based on the last investigation.

@ahmedsameha1
Copy link
Contributor Author

@justinmc Is there any additional needed requirements to merge this PR?

Copy link
Contributor

@justinmc justinmc left a comment

Choose a reason for hiding this comment

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

LGTM 👍 Thank you for dealing with all of my nitpicks on this PR and following through! I appreciate the effort to improve our docs 🙏 .

@ahmedsameha1
Copy link
Contributor Author

This is my first approved PR in the Flutter repository. I'm happy. Thank you.

Copy link
Contributor

@bleroux bleroux left a comment

Choose a reason for hiding this comment

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

LGTM!

@bleroux bleroux added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 9, 2025
@auto-submit auto-submit bot added this pull request to the merge queue Jul 9, 2025
Merged via the queue into flutter:master with commit 55af36a Jul 9, 2025
69 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jul 9, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 9, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 9, 2025
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Jul 9, 2025
flutter/flutter@adffe24...ac12f66

2025-07-09 [email protected] Roll Packages from cba2e90 to 4a231ae (5 revisions) (flutter/flutter#171879)
2025-07-09 [email protected] Replace [FinderBase] with [Finder] in the documentation of Matchers (flutter/flutter#168279)
2025-07-09 [email protected] Revert "Mark web_long_running_tests_2_5 as bringup" (flutter/flutter#171872)
2025-07-09 [email protected] Apply normalization to TimePickerThemeData.inputDecorationTheme (flutter/flutter#171584)
2025-07-09 [email protected] Fix InputDecorationThemeData.activeIndicatorBorder is not applied (flutter/flutter#171764)
2025-07-09 [email protected] Fix multi-view GL rendering not working since software rendering was added (flutter/flutter#171409)
2025-07-09 [email protected] Marks Linux_android_emu android_engine_vulkan_tests to be unflaky (flutter/flutter#171141)
2025-07-08 [email protected] Roll Fuchsia Linux SDK from AinHuT0vgOelA1g7_... to 0-xqmXWc4cXzw3tfe... (flutter/flutter#171823)
2025-07-08 [email protected] Marks Linux_android_emu android_display_cutout to be unflaky (flutter/flutter#171140)
2025-07-08 [email protected] [Documentation] When updating kgp minimum document additional changes that are required (flutter/flutter#171819)
2025-07-08 [email protected] Marks Linux_android_emu android_engine_opengles_tests to be unflaky (flutter/flutter#171142)
2025-07-08 [email protected] Add support for running dart2wasm in dry run mode on js compilations (flutter/flutter#171682)
2025-07-08 [email protected] Remove now duplicate un-forward ports for Android (flutter/flutter#171473)
2025-07-08 [email protected] [skia] Update usage of removed gn flag (flutter/flutter#171800)
2025-07-08 [email protected] [web] Disable auto-formatting for the stack_trace.dart test file (flutter/flutter#171801)
2025-07-08 [email protected] Bump warn and error versions of agp, kotlin and gradle versions in preparation for gradle 9 (flutter/flutter#171776)
2025-07-08 [email protected] Removed string keys (flutter/flutter#171293)
2025-07-08 [email protected] Add `radioSide` to `RadioListTile` (flutter/flutter#171318)
2025-07-08 [email protected] Roll Fuchsia Test Scripts from ZpnML-jis0gVIvtx5... to MnFlN7VWM_7h7EmBV... (flutter/flutter#171787)
2025-07-08 [email protected] Add/use `addMachineOutputFlag`/`outputsMachineFormat` instead of strings (flutter/flutter#171459)
2025-07-08 [email protected] Update translation from console (flutter/flutter#171556)
2025-07-08 [email protected] [ Tool ] Support upgrading to a new Flutter version pointing to the same revision as a previous version (flutter/flutter#171783)
2025-07-08 [email protected] Multi-window support (engine) (flutter/flutter#168728)
2025-07-08 [email protected] Fixes an issue where TapRegion would consume taps regardless of navigation state (flutter/flutter#169067)
2025-07-08 [email protected] SliverSemantics (flutter/flutter#167300)
2025-07-08 [email protected] Roll Skia from e159882c6ce0 to 0fef076beec3 (3 revisions) (flutter/flutter#171779)
2025-07-08 [email protected] Run hot_restart_web_amd_test.dart on Mac/Windows (flutter/flutter#171281)
2025-07-08 [email protected] Roll Packages from 2c52f24 to cba2e90 (2 revisions) (flutter/flutter#171775)

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
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: 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
mboetger pushed a commit to mboetger/flutter that referenced this pull request Jul 9, 2025
…lutter#168279)

Replace [FinderBase] with [Finder] in the doc comments of Matchers.

Closes flutter#168230
@ahmedsameha1 ahmedsameha1 deleted the fix_#168230 branch July 10, 2025 08:57
azatech pushed a commit to azatech/flutter that referenced this pull request Jul 10, 2025
…lutter#168279)

Replace [FinderBase] with [Finder] in the doc comments of Matchers.

Closes flutter#168230
mboetger pushed a commit to mboetger/flutter that referenced this pull request Jul 21, 2025
…lutter#168279)

Replace [FinderBase] with [Finder] in the doc comments of Matchers.

Closes flutter#168230
azatech pushed a commit to azatech/flutter that referenced this pull request Jul 28, 2025
…lutter#168279)

Replace [FinderBase] with [Finder] in the doc comments of Matchers.

Closes flutter#168230
vashworth pushed a commit to vashworth/packages that referenced this pull request Jul 30, 2025
…r#9584)

flutter/flutter@adffe24...ac12f66

2025-07-09 [email protected] Roll Packages from cba2e90 to 4a231ae (5 revisions) (flutter/flutter#171879)
2025-07-09 [email protected] Replace [FinderBase] with [Finder] in the documentation of Matchers (flutter/flutter#168279)
2025-07-09 [email protected] Revert "Mark web_long_running_tests_2_5 as bringup" (flutter/flutter#171872)
2025-07-09 [email protected] Apply normalization to TimePickerThemeData.inputDecorationTheme (flutter/flutter#171584)
2025-07-09 [email protected] Fix InputDecorationThemeData.activeIndicatorBorder is not applied (flutter/flutter#171764)
2025-07-09 [email protected] Fix multi-view GL rendering not working since software rendering was added (flutter/flutter#171409)
2025-07-09 [email protected] Marks Linux_android_emu android_engine_vulkan_tests to be unflaky (flutter/flutter#171141)
2025-07-08 [email protected] Roll Fuchsia Linux SDK from AinHuT0vgOelA1g7_... to 0-xqmXWc4cXzw3tfe... (flutter/flutter#171823)
2025-07-08 [email protected] Marks Linux_android_emu android_display_cutout to be unflaky (flutter/flutter#171140)
2025-07-08 [email protected] [Documentation] When updating kgp minimum document additional changes that are required (flutter/flutter#171819)
2025-07-08 [email protected] Marks Linux_android_emu android_engine_opengles_tests to be unflaky (flutter/flutter#171142)
2025-07-08 [email protected] Add support for running dart2wasm in dry run mode on js compilations (flutter/flutter#171682)
2025-07-08 [email protected] Remove now duplicate un-forward ports for Android (flutter/flutter#171473)
2025-07-08 [email protected] [skia] Update usage of removed gn flag (flutter/flutter#171800)
2025-07-08 [email protected] [web] Disable auto-formatting for the stack_trace.dart test file (flutter/flutter#171801)
2025-07-08 [email protected] Bump warn and error versions of agp, kotlin and gradle versions in preparation for gradle 9 (flutter/flutter#171776)
2025-07-08 [email protected] Removed string keys (flutter/flutter#171293)
2025-07-08 [email protected] Add `radioSide` to `RadioListTile` (flutter/flutter#171318)
2025-07-08 [email protected] Roll Fuchsia Test Scripts from ZpnML-jis0gVIvtx5... to MnFlN7VWM_7h7EmBV... (flutter/flutter#171787)
2025-07-08 [email protected] Add/use `addMachineOutputFlag`/`outputsMachineFormat` instead of strings (flutter/flutter#171459)
2025-07-08 [email protected] Update translation from console (flutter/flutter#171556)
2025-07-08 [email protected] [ Tool ] Support upgrading to a new Flutter version pointing to the same revision as a previous version (flutter/flutter#171783)
2025-07-08 [email protected] Multi-window support (engine) (flutter/flutter#168728)
2025-07-08 [email protected] Fixes an issue where TapRegion would consume taps regardless of navigation state (flutter/flutter#169067)
2025-07-08 [email protected] SliverSemantics (flutter/flutter#167300)
2025-07-08 [email protected] Roll Skia from e159882c6ce0 to 0fef076beec3 (3 revisions) (flutter/flutter#171779)
2025-07-08 [email protected] Run hot_restart_web_amd_test.dart on Mac/Windows (flutter/flutter#171281)
2025-07-08 [email protected] Roll Packages from 2c52f24 to cba2e90 (2 revisions) (flutter/flutter#171775)

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
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: 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
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 16, 2025
ksokolovskyi pushed a commit to ksokolovskyi/flutter that referenced this pull request Aug 19, 2025
…lutter#168279)

Replace [FinderBase] with [Finder] in the doc comments of Matchers.

Closes flutter#168230
lucaantonelli pushed a commit to lucaantonelli/flutter that referenced this pull request Nov 21, 2025
…lutter#168279)

Replace [FinderBase] with [Finder] in the doc comments of Matchers.

Closes flutter#168230
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: tests "flutter test", flutter_test, or one of our tests framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Finder]/[FinderBase] in the documentation of Matchers

3 participants