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() {
  return {
    '@type': 'Organization',
    'name': name,
    if (url != null) 'url': url,
    if (logo != null) 'logo': {'@type': 'ImageObject', 'url': logo},
    if (description != null) 'description': description,
    if (email != null) 'email': email,
    if (telephone != null) 'telephone': telephone,
    if (sameAs != null && sameAs!.isNotEmpty) 'sameAs': sameAs,
    if (address != null) 'address': address!.toMap(),
    if (contactPoint != null) 'contactPoint': contactPoint!.toMap(),
    if (foundingDate != null) 'foundingDate': foundingDate,
    if (numberOfEmployees != null)
      'numberOfEmployees': {
        '@type': 'QuantitativeValue',
        'value': numberOfEmployees,
      },
  };
}