allergensFromJson static method
- List? json
Implementation
static Allergens allergensFromJson(List<dynamic>? json) {
List<String> ids = [];
List<String> names = [];
if (json == null) {
return Allergens(ids, names);
}
for (int i = 0; i < json.length; i++) {
ids.add(json[i].toString());
String name = json[i].toString().substring(3); // remove the 'en:' header.
names.add(name);
}
return Allergens(ids, names);
}