toMap method

  1. @override
Map<String, dynamic> toMap()
override

Convert this schema to a map (without @context). Subclasses must implement this.

Implementation

@override
Map<String, dynamic> toMap() => {
  '@type': 'Event',
  'name': name,
  'startDate': startDate,
  if (endDate != null) 'endDate': endDate,
  if (description != null) 'description': description,
  if (image != null) 'image': image,
  if (url != null) 'url': url,
  if (location != null) 'location': location!.toMap(),
  if (organizer != null) 'organizer': organizer!.toMap(),
  if (performers != null && performers!.isNotEmpty)
    'performer': performers!.map((p) => p.toMap()).toList(),
  if (offer != null) 'offers': offer!.toMap(),
  if (eventStatus != null) 'eventStatus': eventStatus!.url,
  if (eventAttendanceMode != null)
    'eventAttendanceMode': eventAttendanceMode!.url,
  if (previousStartDate != null) 'previousStartDate': previousStartDate,
};