toJsonLd method

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

Serialize SchemaRecipe to JSON-LD

Implementation

@override
Map<String, dynamic> toJsonLd() => removeEmpty({
      ...super.toJsonLd(),
      '@type': 'Recipe',
      'cookTime': convertToJsonLd(cookTime, [SchemaDuration]),
      'cookingMethod': convertToJsonLd(cookingMethod, [String]),
      'ingredients': convertToJsonLd(ingredients, [String]),
      'nutrition': convertToJsonLd(nutrition, [SchemaNutritionInformation]),
      'recipeCategory': convertToJsonLd(recipeCategory, [String]),
      'recipeCuisine': convertToJsonLd(recipeCuisine, [String]),
      'recipeIngredient': convertToJsonLd(
          recipeIngredient, [SchemaItemList, SchemaPropertyValue, String]),
      'recipeInstructions': convertToJsonLd(
          recipeInstructions, [SchemaCreativeWork, SchemaItemList, String]),
      'recipeYield':
          convertToJsonLd(recipeYield, [SchemaQuantitativeValue, String]),
      'suitableForDiet': convertToJsonLd(
          suitableForDiet, [SchemaDiet, SchemaRestrictedDiet]),
    });