toJsonLd method

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

Serialize SchemaRating to JSON-LD

Implementation

@override
Map<String, dynamic> toJsonLd() => removeEmpty({
      ...super.toJsonLd(),
      '@type': 'Rating',
      'author': convertToJsonLd(author, [SchemaOrganization, SchemaPerson]),
      'bestRating': convertToJsonLd(bestRating, [String, num]),
      'ratingExplanation': convertToJsonLd(ratingExplanation, [String]),
      'ratingValue': convertToJsonLd(ratingValue, [String, num]),
      'reviewAspect':
          convertToJsonLd(reviewAspect, [String, SchemaStructuredValue]),
      'worstRating': convertToJsonLd(worstRating, [String, num]),
    });