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:
- Navigation Methods: next, previous, nextYear, previousYear
- Factory Constructors: now(), fromDateTime()
- Validation: Ensures month values stay within 1-12 range
- Immutable: All navigation returns new CalendarView instances
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.new(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
-
final
- next → CalendarView
-
no setter
- nextYear → CalendarView
-
no setter
- previous → CalendarView
-
no setter
- previousYear → CalendarView
-
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- year → int
-
final
Methods
-
copyWith(
{ValueGetter< int> ? year, ValueGetter<int> ? month}) → CalendarView -
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