@@ -37,6 +37,7 @@ import 'widget_tester.dart' show WidgetTester;
37
37
/// * [findsWidgets] , when you want the finder to find one or more widgets.
38
38
/// * [findsOneWidget] , when you want the finder to find exactly one widget.
39
39
/// * [findsNWidgets] , when you want the finder to find a specific number of widgets.
40
+ /// * [findsAtLeastNWidgets] , when you want the finder to find at least a specific number of widgets.
40
41
const Matcher findsNothing = _FindsWidgetMatcher (null , 0 );
41
42
42
43
/// Asserts that the [Finder] locates at least one widget in the widget tree.
@@ -52,6 +53,7 @@ const Matcher findsNothing = _FindsWidgetMatcher(null, 0);
52
53
/// * [findsNothing] , when you want the finder to not find anything.
53
54
/// * [findsOneWidget] , when you want the finder to find exactly one widget.
54
55
/// * [findsNWidgets] , when you want the finder to find a specific number of widgets.
56
+ /// * [findsAtLeastNWidgets] , when you want the finder to find at least a specific number of widgets.
55
57
const Matcher findsWidgets = _FindsWidgetMatcher (1 , null );
56
58
57
59
/// Asserts that the [Finder] locates at exactly one widget in the widget tree.
@@ -67,6 +69,7 @@ const Matcher findsWidgets = _FindsWidgetMatcher(1, null);
67
69
/// * [findsNothing] , when you want the finder to not find anything.
68
70
/// * [findsWidgets] , when you want the finder to find one or more widgets.
69
71
/// * [findsNWidgets] , when you want the finder to find a specific number of widgets.
72
+ /// * [findsAtLeastNWidgets] , when you want the finder to find at least a specific number of widgets.
70
73
const Matcher findsOneWidget = _FindsWidgetMatcher (1 , 1 );
71
74
72
75
/// Asserts that the [Finder] locates the specified number of widgets in the widget tree.
@@ -82,8 +85,25 @@ const Matcher findsOneWidget = _FindsWidgetMatcher(1, 1);
82
85
/// * [findsNothing] , when you want the finder to not find anything.
83
86
/// * [findsWidgets] , when you want the finder to find one or more widgets.
84
87
/// * [findsOneWidget] , when you want the finder to find exactly one widget.
88
+ /// * [findsAtLeastNWidgets] , when you want the finder to find at least a specific number of widgets.
85
89
Matcher findsNWidgets (int n) => _FindsWidgetMatcher (n, n);
86
90
91
+ /// Asserts that the [Finder] locates at least a number of widgets in the widget tree.
92
+ ///
93
+ /// ## Sample code
94
+ ///
95
+ /// ```dart
96
+ /// expect(find.text('Save'), findsAtLeastNWidgets(2));
97
+ /// ```
98
+ ///
99
+ /// See also:
100
+ ///
101
+ /// * [findsNothing] , when you want the finder to not find anything.
102
+ /// * [findsWidgets] , when you want the finder to find one or more widgets.
103
+ /// * [findsOneWidget] , when you want the finder to find exactly one widget.
104
+ /// * [findsNWidgets] , when you want the finder to find a specific number of widgets.
105
+ Matcher findsAtLeastNWidgets (int n) => _FindsWidgetMatcher (n, null );
106
+
87
107
/// Asserts that the [Finder] locates a single widget that has at
88
108
/// least one [Offstage] widget ancestor.
89
109
///
0 commit comments