CalendarView class

Represents a specific month and year view in calendar navigation.

Provides immutable representation of a calendar's current viewing position with navigation methods to move between months and years. Used to control which month/year combination is displayed in calendar grids.

Key Features:

Example:

// Create views for different dates
final current = CalendarView.now();
final specific = CalendarView(2024, 3); // March 2024
final fromDate = CalendarView.fromDateTime(someDateTime);

// Navigate between months
final nextMonth = current.next;
final prevMonth = current.previous;
final nextYear = current.nextYear;

Constructors

CalendarView(int year, int month)
Creates a CalendarView for the specified year and month.
CalendarView.fromDateTime(DateTime dateTime)
Creates a CalendarView from an existing DateTime.
factory
CalendarView.now()
Creates a CalendarView for the current month and year.
factory

Properties

hashCode int
The hash code for this object.
no setteroverride
month int
The month component of this view (1-12).
final
next CalendarView
Returns a view for the next month.
no setter
nextYear CalendarView
Returns a view for the next year with the same month.
no setter
previous CalendarView
Returns a view for the previous month.
no setter
previousYear CalendarView
Returns a view for the previous year with the same month.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
year int
The year component of this view.
final

Methods

copyWith({ValueGetter<int>? year, ValueGetter<int>? month}) CalendarView
Creates a copy of this view with the given fields replaced.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
override