toJsonLd method

String toJsonLd()

Convert to a complete JSON-LD string with @context.

This is what gets injected into the document head as a <script type="application/ld+json"> tag.

Implementation

String toJsonLd() {
  final map = <String, dynamic>{'@context': 'https://schema.org', ...toMap()};
  return const JsonEncoder.withIndent('  ').convert(map);
}