pumpAnimation method

Future<void> pumpAnimation(
  1. Duration duration, {
  2. int fps = 60,
})

Pumps the widget tester as if simulating an animation, with a pump every several milliseconds based on the provided fps, until the given duration has ellapsed.

Implementation

Future<void> pumpAnimation(Duration duration, {int fps = 60}) async {
  final frameDuration = const Duration(seconds: 1) * (1.0 / fps);
  final frames =
      (duration.inMicroseconds / frameDuration.inMicroseconds).round();

  for (var i = 0; i < frames; i++) {
    await pump(frameDuration);
  }
}