fromJson static method
Implementation
static Product fromJson(Map<String, dynamic> json) => Product(
name: json['name'],
code: json['code'],
description: json['description'],
imageUrl: json['imageUrl'],
weight: (json['weight'] as num?)?.toDouble(),
cookingGuidelines: json['cookingGuidelines'],
microwaveCookingInstructions: json['microwaveCookingInstructions'],
ovenCookingInstructions: json['ovenCookingInstructions'],
storageInstructions: json['storageInstructions'],
unitsPerCase: (json['unitsPerCase'] as num?)?.toInt(),
plainTextIngredients: json['plainTextIngredients'],
htmlIngredients: json['htmlIngredients'],
formulation: json['formulation'],
isAvailable: json['isAvailable'],
isNew: json['isNew'],
servingPortions: (json['servingPortions'] as num?)?.toInt(),
servingSize: (json['servingSize'] as num?)?.toDouble(),
range: json['range'] != null ? Range.fromJson(json['range']) : null,
servingType: json['servingType'] != null
? ServingType.fromJson(json['servingType'])
: null,
productAllergens: (json['productAllergens'] as List<dynamic>?)
?.map((e) => ProductAllergen.fromJson(e))
.toList(),
productCatalogs: (json['productCatalogs'] as List<dynamic>?)
?.map((e) => ProductCatalog.fromJson(e))
.toList(),
productDiets: (json['productDiets'] as List<dynamic>?)
?.map((e) => ProductDiet.fromJson(e))
.toList(),
productFreeFroms: (json['productFreeFroms'] as List<dynamic>?)
?.map((e) => ProductFreeFrom.fromJson(e))
.toList(),
productGroups: (json['productGroups'] as List<dynamic>?)
?.map((e) => ProductGroup.fromJson(e))
.toList(),
productMadeWithouts: (json['productMadeWithouts'] as List<dynamic>?)
?.map((e) => ProductMadeWithout.fromJson(e))
.toList(),
productMealTypes: (json['productMealTypes'] as List<dynamic>?)
?.map((e) => ProductMealType.fromJson(e))
.toList(),
productMicrowaveStages:
(json['productMicrowaveStages'] as List<dynamic>?)
?.map((e) => ProductMicrowaveStage.fromJson(e))
.toList(),
productNutritions: (json['productNutritions'] as List<dynamic>?)
?.map((e) => ProductNutrition.fromJson(e))
.toList(),
productPrecautionaryAllergenStatements:
(json['productPrecautionaryAllergenStatements'] as List<dynamic>?)
?.map((e) => ProductPrecautionaryAllergenStatement.fromJson(e))
.toList(),
productWarnings: (json['productWarnings'] as List<dynamic>?)
?.map((e) => ProductWarning.fromJson(e))
.toList(),
id: json['id'],
created:
json['created'] != null ? DateTime.parse(json['created']) : null,
creator: json['creator'],
updated:
json['updated'] != null ? DateTime.parse(json['updated']) : null,
updater: json['updater'],
);