# Package com.codename1.health.nutrition

package com.codename1.health.nutrition

Logged food and drink, as a sparse set of nutrient amounts.

Start at `NutritionSample`, written and read through the ordinary `HealthStore` using `HealthDataType.NUTRITION`.

Both platforms model nutrition as a record with several dozen optional nutrient fields. This package keeps that sparseness explicit rather than exposing forty nullable getters: an entry carries only the nutrients that were actually measured, and a nutrient that was never measured reads back as null rather than zero.

##### Local and simulator only in this release

`HealthDataType.NUTRITION` is not carried to HealthKit or Health Connect yet: neither the wire format nor either port's type map knows the multi-nutrient record shape, so a read or a write of it on a phone is refused with `HealthError.TYPE_NOT_SUPPORTED` before it reaches the platform. It works fully against the local store -- the simulator, and the desktop, Windows, Linux and JavaScript ports.

Individual dietary quantities do reach the phones and are ordinary `QuantitySample`s rather than entries here: `HYDRATION` on both platforms, and `DIETARY_ENERGY` on iOS. Use those when the number has to land in the user's real health store.

- Related Packages
  Package
  Description
  com.codename1.health
  Cross-platform health data: reading and writing samples, aggregating them over time, watching the store for changes, and recording workouts.
  com.codename1.health.sensors
  Standard Bluetooth SIG health sensors -- heart-rate straps, power meters, speed and cadence sensors, foot pods, thermometers, scales, blood-pressure cuffs and glucose meters.
  com.codename1.health.workout
  Workout recording, live where the operating system supports it and framework-recorded everywhere else.
- Classes
  Class
  Description
  Nutrient
  A single nutrient that a `NutritionSample` can carry -- a macronutrient, a vitamin, a mineral.
  NutritionSample
  A logged food or meal, carrying whichever nutrients are known about it.