findsNWidgets function

Matcher findsNWidgets(
  1. int n
)

Asserts that the Finder locates the specified number of widgets in the widget tree.

This is equivalent to the preferred findsExactly method.

Sample code

expect(find.text('Save'), findsNWidgets(2));

See also:

  • findsNothing, when you want the finder to not find anything.
  • findsAny, when you want the finder to find one or more candidates.
  • findsOne, when you want the finder to find exactly one candidate.
  • findsAtLeast, when you want the finder to find at least a specific number of candidates.

Implementation

Matcher findsNWidgets(int n) => _FindsCountMatcher(n, n);