toJsonLd method

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

Serialize SchemaRating to JSON-LD

Implementation

@override
Map<String, dynamic> toJsonLd() => removeEmpty({
      '@context': 'https://schema.org',
      '@type': 'Rating',
      'author': convertToJsonLd(author, [SchemaOrganization, SchemaPerson]),
      'bestRating': convertToJsonLd(bestRating, [String, int]),
      'ratingExplanation': convertToJsonLd(ratingExplanation, [String]),
      'ratingValue': convertToJsonLd(ratingValue, [String, int]),
      'reviewAspect': convertToJsonLd(reviewAspect, [String]),
      'worstRating': convertToJsonLd(worstRating, [String, int]),
      'additionalType': convertToJsonLd(additionalType, [String, String]),
      'alternateName': convertToJsonLd(alternateName, [String]),
      'description': convertToJsonLd(description, [String, SchemaTextObject]),
      'disambiguatingDescription':
          convertToJsonLd(disambiguatingDescription, [String]),
      'identifier':
          convertToJsonLd(identifier, [SchemaPropertyValue, String, String]),
      'image': convertToJsonLd(image, [SchemaImageObject, String]),
      'mainEntityOfPage':
          convertToJsonLd(mainEntityOfPage, [SchemaCreativeWork, String]),
      'name': convertToJsonLd(name, [String]),
      'potentialAction': convertToJsonLd(potentialAction, [SchemaAction]),
      'sameAs': convertToJsonLd(sameAs, [String]),
      'subjectOf':
          convertToJsonLd(subjectOf, [SchemaCreativeWork, SchemaEvent]),
      'url': convertToJsonLd(url, [String]),
    });