animateTo method
Animates the current page to the given date's page.
Contract
Throws AssertionError if date is not within [start, end].
Testing
To avoid timeouts in widget tests, always wrap the returned Future in unawaited.
testWidgets('shows', (tester) async {
await tester.pumpWidget(...);
unawaited(controller.show());
await tester.pumpAndSettle();
});
Implementation
Future<void> animateTo(
DateTime date, {
Duration duration = const Duration(milliseconds: 200),
Curve curve = Curves.ease,
}) {
assert(debugCheckInclusiveDateRange(start, date, end));
return _animateTo(_from(date), duration, curve);
}