Skip to content

Commit

Permalink
Update documentation for Version 5.9.0 (Tests) (#547)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
gustamor authored May 8, 2024
1 parent 987c462 commit f4a329e
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -361,3 +361,28 @@ To use second method run: `flutter run --dart-define=method=2`

![effect](demo_en.png)
![tablet effect](demo_tablet_en.png)


### Update for Version 5.9.0 (Tests)
Reported as bug in [#515](https://github.com/OpenFlutter/flutter_screenutil/issues/515)


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.

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

Example usage:
```dart
testWidgets('Should ensure widgets settle correctly', (WidgetTester tester) async {
await tester.pumpWidget(
const MaterialApp(
home: ScreenUtilInit(
child: MyApp(),
),
),
);
// Insertion of recommended method to prevent failures
await tester.pumpAndSettle();
// Continue with your assertions and tests
});
```

0 comments on commit f4a329e

Please sign in to comment.