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': 'Person',
  'name': name,
  if (url != null) 'url': url,
  if (image != null) 'image': image,
  if (email != null) 'email': email,
  if (telephone != null) 'telephone': telephone,
  if (jobTitle != null) 'jobTitle': jobTitle,
  if (description != null) 'description': description,
  if (worksFor != null)
    'worksFor': {'@type': 'Organization', 'name': worksFor},
  if (alumniOf != null)
    'alumniOf': {'@type': 'EducationalOrganization', 'name': alumniOf},
  if (birthDate != null) 'birthDate': birthDate,
  if (nationality != null)
    'nationality': {'@type': 'Country', 'name': nationality},
  if (sameAs != null && sameAs!.isNotEmpty) 'sameAs': sameAs,
  if (knowsAbout != null && knowsAbout!.isNotEmpty) 'knowsAbout': knowsAbout,
};