KalenderEvent class Events

Base class for events displayed in the calendar.

Stores a UTC date range, a unique id, and an interaction config. Extend this class to attach custom data (title, color, etc.).

class Event extends KalenderEvent {
  Event({
    super.id,
    required super.start,
    required super.end,
    required this.title,
    super.interaction,
    super.multiDayRule,
  });
  final String title;

  @override
  Event copyWithData({required DateTime start, required DateTime end}) {
    return Event(start: start, end: end, title: title);
  }

  @override
  bool operator ==(Object other) =>
      super == other && other is Event && other.title == title;

  @override
  int get hashCode => Object.hash(super.hashCode, title);
}

copyWithData rebuilds only what the subclass adds. id, interaction, multiDayRule and isAllDay are reapplied by carryOver afterwards, so a field added to this class later reaches every subclass without any of them changing.

Constructors

KalenderEvent({String? id, required DateTime start, required DateTime end, EventInteraction? interaction, MultiDayRule? multiDayRule, bool isAllDay = false})
start must not be after end. A null interaction means fully modifiable.

Properties

dateTimeRange → KalenderDateTimeRange
The date range as a KalenderDateTimeRange.
no setter
duration → Duration
Total duration (UTC-based).
no setter
end → DateTime
The end of the event in UTC.
final
hashCode → int
The hash code for this object.
no setteroverride
id ↔ String
Unique identifier. Auto-generated if not provided.
getter/setter pair
interaction → EventInteraction
Controls whether the event can be moved, resized, etc.
no setter
isAllDay → bool
Whether this event occupies whole days rather than a span of time.
no setter
multiDayRule → MultiDayRule?
Overrides the calendar's rule for this event alone.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
start → DateTime
The start of the event in UTC.
final

Methods

carryOver<T extends KalenderEvent>(T copy) → T
Reapplies the state KalenderEvent holds to copy, and returns it.
copyWithData({required DateTime start, required DateTime end}) → KalenderEvent
Rebuilds this event covering start to end, keeping the data this subclass adds.
datesSpanned({Location? location}) → List<FloatingDateTime>
All dates this event spans, adjusted for location.
floatingEnd({Location? location}) → FloatingDateTime
The end as an FloatingDateTime, adjusted for location.
floatingRange({Location? location}) → FloatingDateTimeRange
The full range as an FloatingDateTimeRange, adjusted for location.
floatingStart({Location? location}) → FloatingDateTime
The start as an FloatingDateTime, adjusted for location.
layoutEquals(KalenderEvent other) → bool
Compares layout-affecting properties (id, start, end, interaction, multiDayRule, isAllDay).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
spansMultipleDays({required Location? location, required MultiDayRule defaultRule}) → bool
Whether this event belongs in the multi-day header lane rather than the day timeline, with calendar days measured in location.
toString() → String
A string representation of this object.
override
withDateTimeRange(KalenderDateTimeRange dateTimeRange) → KalenderEvent
A copy of this event covering dateTimeRange, made by copyWithData then carryOver.

Operators

operator ==(Object other) → bool
Check equality based on layoutEquals.
override