times method
This speed with every duration multiplied by factor.
PlaybookSpeed.natural.times(2) is twice as slow as natural.
Implementation
PlaybookSpeed times(num factor) {
if (factor <= 0) {
throw ArgumentError.value(factor, 'factor', 'must be greater than 0');
}
Duration scale(Duration duration) =>
Duration(microseconds: (duration.inMicroseconds * factor).round());
final String label = factor == factor.roundToDouble()
? '${factor.round()}'
: '$factor';
return PlaybookSpeed(
name: '$nameĆ$label',
betweenSteps: scale(betweenSteps),
tapHold: scale(tapHold),
perCharacter: scale(perCharacter),
typingJitter: typingJitter,
fingerTravel: scale(fingerTravel),
swipe: scale(swipe),
afterNavigation: scale(afterNavigation),
);
}