additivesFromJson static method

Additives additivesFromJson(
  1. List? json
)

Implementation

static Additives additivesFromJson(List<dynamic>? json) {
  List<String> ids = [];
  List<String> names = [];

  if (json == null) {
    return Additives(ids, names);
  }

  for (int i = 0; i < json.length; i++) {
    ids.add(json[i].toString());
    String name =
        'E${json[i].toString().substring(4)}'; // remove the 'en:' header and Capitalize the 'E'.
    names.add(name);
  }

  return Additives(ids, names);
}