findsOneWidget top-level constant Null safety

Matcher const findsOneWidget

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.
  • findsAtLeastNWidgets, when you want the finder to find at least a specific number of widgets.

Implementation

const Matcher findsOneWidget = _FindsWidgetMatcher(1, 1);