Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Replace [FinderBase] with [Finder] in the documentation of Matchers #168279

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

ahmedsameha1
Copy link

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

This is my try to fix #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
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
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.

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

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

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

/// 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
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 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
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
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 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
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
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
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
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
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
Author

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

@ahmedsameha1
Copy link
Author

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

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.

2 participants