@@ -109,7 +109,7 @@ void checkNoDialog(WidgetTester tester) {
109109/// Tap the action button by calling `tester.tap(find.byWidget(actionButton))` .
110110 (Widget , Widget ) checkSuggestedActionDialog (WidgetTester tester, {
111111 required String expectedTitle,
112- required String expectedMessage,
112+ String ? expectedMessage,
113113 String ? expectedActionButtonText,
114114 bool expectDestructiveActionButton = false ,
115115}) {
@@ -121,8 +121,10 @@ void checkNoDialog(WidgetTester tester) {
121121 final dialog = tester.widget <AlertDialog >(find.bySubtype <AlertDialog >());
122122 tester.widget (find.descendant (matchRoot: true ,
123123 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+ }
126128
127129 final actionButton = tester.widget (find.descendant (of: find.byWidget (dialog),
128130 matching: find.widgetWithText (TextButton , expectedActionButtonText ?? 'Continue' )));
@@ -135,8 +137,10 @@ void checkNoDialog(WidgetTester tester) {
135137 final dialog = tester.widget <CupertinoAlertDialog >(find.byType (CupertinoAlertDialog ));
136138 tester.widget (find.descendant (matchRoot: true ,
137139 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+ }
140144
141145 final actionButton = tester.widget <CupertinoDialogAction >(
142146 find.descendant (
0 commit comments