forward property Null safety

VoidCallback? forward
read / write

Moves to the next view programmatically with animation by checking that the next view dates falls between the minimum and maximum date range.

Note: If the current view has the maximum date range, it will not move to the next view.

class MyAppState extends State<MyApp> {
 CalendarController _calendarController = CalendarController();

 @override
 initState() {
   _calendarController.selectedDate = DateTime(2022, 02, 05);
   _calendarController.displayDate = DateTime(2022, 02, 05);
   super.initState();
 }

 @override
 Widget build(BuildContext context) {
   return MaterialApp(
     home: Scaffold(
       appBar: AppBar(
         title: Text('Calendar Demo'),
         actions: <Widget>[
           IconButton(
             icon: Icon(Icons.arrow_forward),
             onPressed: () {
               _calendarController.forward!();
             },
           ),
         ],
         leading: IconButton(
           icon: Icon(Icons.arrow_back),
           onPressed: () {
             _calendarController.backward!();
           },
         ),
       ),
       body: SfCalendar(
         view: CalendarView.month,
         controller: _calendarController,
       ),
     ),
   );
 }
}

Implementation

VoidCallback? forward;