NutritionProduct.fromJsonString constructor
NutritionProduct.fromJsonString(
- String source
Acts like a constructor, returns a NutritionProduct, accepts a String as an argument, mostly because I got tired of typing it out
Implementation
factory NutritionProduct.fromJsonString(String source) {
final dynamic json = jsonDecode(source);
if (json is Map<String, dynamic>) {
return _$NutritionProductFromJson(json);
} else {
throw FormatException('FormatException:\nYou passed $json\n'
'This does not properly decode to a Map<String,dynamic>.');
}
}