Skip to content

Commit f4a329e

Browse files
authored
Update documentation for Version 5.9.0 (Tests) (#547)
* Update documentation for Version 5.9.0 (Tests) This pull request updates the documentation to express the need for using pumpAndSettle() in widget tests to ensure compatibility and proper functioning in version 5.9.0. * Update documentation for Version 5.9.0 (Tests) This pull request updates the documentation to express the need for using pumpAndSettle() in widget tests to ensure compatibility and proper functioning in version 5.9.0.
1 parent 987c462 commit f4a329e

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

README.md

+25
Original file line numberDiff line numberDiff line change
@@ -361,3 +361,28 @@ To use second method run: `flutter run --dart-define=method=2`
361361

362362
![effect](demo_en.png)
363363
![tablet effect](demo_tablet_en.png)
364+
365+
366+
### Update for Version 5.9.0 (Tests)
367+
Reported as bug in [#515](https://github.com/OpenFlutter/flutter_screenutil/issues/515)
368+
369+
370+
In version 5.9.0, to ensure compatibility and proper functioning of your tests, it is crucial to use the method `tester.pumpAndSettle()`; when conducting widget tests that depend on animations or a settling time to complete their state.
371+
372+
In the previous version, this step was not strictly necessary. However, to maintain consistency in your tests and avoid unexpected errors, it's strongly recommended incorporating await tester.pumpAndSettle(); in your widget tests if you are using version 5.9.0
373+
374+
Example usage:
375+
```dart
376+
testWidgets('Should ensure widgets settle correctly', (WidgetTester tester) async {
377+
await tester.pumpWidget(
378+
const MaterialApp(
379+
home: ScreenUtilInit(
380+
child: MyApp(),
381+
),
382+
),
383+
);
384+
// Insertion of recommended method to prevent failures
385+
await tester.pumpAndSettle();
386+
// Continue with your assertions and tests
387+
});
388+
```

0 commit comments

Comments
 (0)