findsNWidgets function Null safety

Matcher findsNWidgets(
  1. int n
)

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

Sample code

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

See also:

  • findsNothing, when you want the finder to not find anything.
  • findsWidgets, when you want the finder to find one or more widgets.
  • findsOneWidget, when you want the finder to find exactly one widget.

Implementation

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