You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"description": "Whether the drink is suitable for vegans. May be provided as boolean, integer (0/1), or string ('true'/'false'/'yes'/'no'/'1'/'0'). Legacy key 'vegan' may appear in older data and is treated as a fallback.",
bar: json['bar'], // Handles String, int, or boolean
274
+
vegan: json['is_vegan'] ?? json['vegan'], // Handles bool, int, or String; 'vegan' is legacy fallback
273
275
allergens: parseAllergens(json['allergens']), // Handles int, bool, or num
274
276
}
275
277
```
@@ -280,7 +282,8 @@ Product.fromJson(json) → {
280
282
2.**Allergens** values can be `int`, `bool`, or `num`
281
283
3.**Year founded** can be `int` or `String`
282
284
4.**Bar** can be `String`, `int`, or `boolean`
283
-
5. Handle null values gracefully with `?.` and `??`
285
+
5.**is_vegan** can be `bool`, `int`/`num`, or `String` (`"yes"`/`"no"`/`"true"`/`"false"`/`"1"`/`"0"`); legacy key `vegan` is also supported as a fallback
286
+
6. Handle null values gracefully with `?.` and `??`
0 commit comments