toJson method

Map<String, Object?> toJson()

Implementation

Map<String, Object?> toJson() {
  final end = this.end;
  final event = this.event;
  final eventsAfter = this.eventsAfter;
  final eventsBefore = this.eventsBefore;
  final start = this.start;
  final state = this.state;
  return {
    if (end != null) 'end': end,
    if (event != null) 'event': event.toJson(),
    if (eventsAfter != null)
      'events_after': eventsAfter.map((v) => v.toJson()).toList(),
    if (eventsBefore != null)
      'events_before': eventsBefore.map((v) => v.toJson()).toList(),
    if (start != null) 'start': start,
    if (state != null) 'state': state.map((v) => v.toJson()).toList(),
  };
}