delay method Null safety

Future delay(
  1. num time
)

Returns a Future which completes after time seconds.

This method is based on the onElapsedTimeChange stream and is therefore executed before all other animatables.

await juggler.delay(1.0);

Implementation

Future delay(num time) async {
  final nextTime = elapsedTime + time;
  await for (var elapsedTime in onElapsedTimeChange) {
    if (elapsedTime >= nextTime) break;
  }
}