findsOneWidget top-level constant

const findsOneWidget = const _FindsWidgetMatcher(1, 1)

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

Sample code

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

See also:

  • findsNothing, when you want the finder to not find anything.
  • findsWidgets, when you want the finder to find one or more widgets.
  • findsNWidgets, when you want the finder to find a specific number of widgets.

Implementation

const Matcher findsOneWidget = _FindsWidgetMatcher(1, 1)