animateFromTo method
Future<void>
animateFromTo(
{ - int fromIndex = 0,
- required int toIndex,
- Duration delayDuration = const Duration(milliseconds: 500),
- bool isReverse = false,
})
Implementation
Future<void> animateFromTo({
int fromIndex = 0,
required int toIndex,
Duration delayDuration = const Duration(milliseconds: 500),
bool isReverse = false,
}) async {
for (var i = fromIndex;
(!isReverse) ? i < toIndex : i > toIndex;
(isReverse) ? i-- : i++) {
await Future.delayed(delayDuration);
if (isReverse) {
if (i < 0) {
continue;
} else if (i > length) {
return;
}
} else {
if (i > length) {
return;
}
}
animateTo(
i,
);
}
return;
}