addTime method Null safety
- Duration duration
Increase the timeout for the current test by the given duration.
This only matters if the test has an
initialTimeout set on
testWidgets, and the test is running via
flutter test. By default,
tests do not have such a timeout. Tests run using
flutter run never time
out even if one is specified.
This method has no effect on the timeout specified via
testWidgets. That timeout is implemented by the
By default, each pump and WidgetTester.pumpWidget call increases the timeout by a hundred milliseconds, and each matchesGoldenFile expectation increases it by a minute. If there is no timeout in the first place, this has no effect.
The granularity of timeouts is coarse: the time is checked once per second, and only when the test is not executing. It is therefore possible for a timeout to be exceeded by hundreds of milliseconds and for the test to still succeed. If precise timing is required, it should be implemented as a part of the test rather than relying on this mechanism.
// See AutomatedTestWidgetsFlutterBinding.addTime for an actual implementation. void addTime(Duration duration);