findsOneWidget top-level constant

Matcher const findsOneWidget

Asserts that the Finder locates at exactly one widget in the widget tree.

This is equivalent to the preferred findsOne method.

Sample code

expect(find.text('Save'), findsOneWidget);

See also:

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

Implementation

const Matcher findsOneWidget = _FindsCountMatcher(1, 1);