build method

void build()

Builds and registers the event configuration.

This method validates the configuration and registers the event with the scheduler core.

Throws an exception if required parameters are missing:

  • eventKey
  • triggerType
  • onEvent

Also throws if required parameters for the selected trigger type or recurrence type are missing.

Implementation

void build() {
  if (_eventKey == null || _triggerType == null || _onEvent == null) {
    throw Exception('Event key, trigger type, and onEvent must be set.');
  }

  final config = SchedulerConfig(
    eventKey: _eventKey!,
    triggerType: _triggerType!,
    recurrenceType: _recurrenceType,
    onEvent: _onEvent!,
    recurrenceOnEvent: _recurrenceOnEvent,
    onStateUpdate: _onStateUpdate,
    triggerTime: _triggerTime,
    triggerCount: _triggerCount,
    recurrenceInterval: _recurrenceInterval,
    recurrenceCount: _recurrenceCount,
    maxRecurrences: _maxRecurrences,
    endTime: _endTime,
  );

  SchedulerCore.register(config);
}