toJson static method

Map<String, dynamic>? toJson(
  1. NutrientLevels? nutrientLevels
)

Implementation

static Map<String, dynamic>? toJson(NutrientLevels? nutrientLevels) {
  Map<String, String> result = {};

  if (nutrientLevels == null) {
    return null;
  }

  for (int i = 0; i < nutrientLevels.levels.length; i++) {
    var key = nutrients[i];
    result[key] = nutrientLevels.levels[key].value;
  }

  return result;
}