randomTimeDelayed static method
在 minDuration
- maxDuration
之间随机取值延时等待
Implementation
static Future<void> randomTimeDelayed({
required Duration minDuration,
required Duration maxDuration,
}) {
assert(maxDuration.inMilliseconds >= minDuration.inMilliseconds);
return Future.delayed(Duration(
milliseconds: random.nextInt(
maxDuration.inMilliseconds - minDuration.inMilliseconds,
) +
minDuration.inMilliseconds,
));
}