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

Merged
merged 6 commits into from
Jul 9, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions packages/flutter_test/lib/src/matchers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import 'widget_tester.dart' show WidgetTester;
/// * [findsAtLeast], when you want the finder to find at least a specific number of candidates.
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.

///
/// This is equivalent to the preferred [findsAny] method.
///
Expand Down Expand Up @@ -78,7 +78,7 @@ const Matcher findsWidgets = _FindsCountMatcher(1, null);
/// * [findsAtLeast], when you want the finder to find at least a specific number of candidates.
const Matcher findsAny = _FindsCountMatcher(1, null);

/// Asserts that the [Finder] locates at exactly one widget in the widget tree.
/// Asserts that the [FinderBase] locates at exactly one widget in the widget tree.
///
/// This is equivalent to the preferred [findsOne] method.
///
Expand Down Expand Up @@ -112,7 +112,7 @@ const Matcher findsOneWidget = _FindsCountMatcher(1, 1);
/// * [findsAtLeast], when you want the finder to find at least a specific number of candidates.
const Matcher findsOne = _FindsCountMatcher(1, 1);

/// Asserts that the [Finder] locates the specified number of widgets in the widget tree.
/// Asserts that the [FinderBase] locates the specified number of widgets in the widget tree.
///
/// This is equivalent to the preferred [findsExactly] method.
///
Expand Down Expand Up @@ -146,7 +146,7 @@ Matcher findsNWidgets(int n) => _FindsCountMatcher(n, n);
/// * [findsAtLeast], when you want the finder to find at least a specific number of candidates.
Matcher findsExactly(int n) => _FindsCountMatcher(n, n);

/// Asserts that the [Finder] locates at least a number of widgets in the widget tree.
/// Asserts that the [FinderBase] locates at least a number of widgets in the widget tree.
///
/// This is equivalent to the preferred [findsAtLeast] method.
///
Expand Down Expand Up @@ -644,7 +644,7 @@ AsyncMatcher matchesReferenceImage(ui.Image image) {
/// cases that [SemanticsController.find] sometimes runs into.
///
/// To retrieve the semantics data of a widget, use [SemanticsController.find]
/// with a [Finder] that returns a single widget. Semantics must be enabled
/// with a [FinderBase] that returns a single widget. Semantics must be enabled
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 is indeed a FinderBase, specifically FinderBase<SemanticsNode>.

FinderBase<SemanticsNode>() => node.evaluate().single.getSemanticsData(),

Would it help to specify the type here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In this file, I don't see any mention of a FinderBase in doc comments that specify its generic type, so let it without its generic type.

/// in order to use this method.
///
/// ## Sample code
Expand Down Expand Up @@ -840,7 +840,7 @@ Matcher matchesSemantics({
/// cases that [SemanticsController.find] sometimes runs into.
///
/// To retrieve the semantics data of a widget, use [SemanticsController.find]
/// with a [Finder] that returns a single widget. Semantics must be enabled
/// with a [FinderBase] that returns a single widget. Semantics must be enabled
Copy link
Contributor

Choose a reason for hiding this comment

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

Same for this one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In this file, I don't see any mention of a FinderBase in doc comments that specify its generic type, so let it without its generic type.

/// in order to use this method.
///
/// ## Sample code
Expand Down