@@ -109,7 +109,7 @@ void checkNoDialog(WidgetTester tester) {
109
109
/// Tap the action button by calling `tester.tap(find.byWidget(actionButton))` .
110
110
(Widget , Widget ) checkSuggestedActionDialog (WidgetTester tester, {
111
111
required String expectedTitle,
112
- required String expectedMessage,
112
+ String ? expectedMessage,
113
113
String ? expectedActionButtonText,
114
114
bool expectDestructiveActionButton = false ,
115
115
}) {
@@ -121,8 +121,10 @@ void checkNoDialog(WidgetTester tester) {
121
121
final dialog = tester.widget <AlertDialog >(find.bySubtype <AlertDialog >());
122
122
tester.widget (find.descendant (matchRoot: true ,
123
123
of: find.byWidget (dialog.title! ), matching: find.text (expectedTitle)));
124
- tester.widget (find.descendant (matchRoot: true ,
125
- of: find.byWidget (dialog.content! ), matching: find.text (expectedMessage)));
124
+ if (expectedMessage != null ) {
125
+ tester.widget (find.descendant (matchRoot: true ,
126
+ of: find.byWidget (dialog.content! ), matching: find.text (expectedMessage)));
127
+ }
126
128
127
129
final actionButton = tester.widget (find.descendant (of: find.byWidget (dialog),
128
130
matching: find.widgetWithText (TextButton , expectedActionButtonText ?? 'Continue' )));
@@ -135,8 +137,10 @@ void checkNoDialog(WidgetTester tester) {
135
137
final dialog = tester.widget <CupertinoAlertDialog >(find.byType (CupertinoAlertDialog ));
136
138
tester.widget (find.descendant (matchRoot: true ,
137
139
of: find.byWidget (dialog.title! ), matching: find.text (expectedTitle)));
138
- tester.widget (find.descendant (matchRoot: true ,
139
- of: find.byWidget (dialog.content! ), matching: find.text (expectedMessage)));
140
+ if (expectedMessage != null ) {
141
+ tester.widget (find.descendant (matchRoot: true ,
142
+ of: find.byWidget (dialog.content! ), matching: find.text (expectedMessage)));
143
+ }
140
144
141
145
final actionButton = tester.widget <CupertinoDialogAction >(
142
146
find.descendant (
0 commit comments