CalendarView.fromDateTime constructor

CalendarView.fromDateTime(
  1. DateTime dateTime
)

Creates a CalendarView from an existing DateTime.

Extracts the year and month components from the provided DateTime and creates a corresponding calendar view.

Parameters:

  • dateTime (DateTime): Date to extract year and month from

Example:

final birthday = DateTime(1995, 7, 15);
final view = CalendarView.fromDateTime(birthday); // July 1995

Implementation

factory CalendarView.fromDateTime(DateTime dateTime) {
  return CalendarView(dateTime.year, dateTime.month);
}