fetchFoodItemForProductCode
Import
import {
PassioSDK,
type PassioFoodItem,
type PackagedFoodCode,
} from '@passiolife/nutritionai-react-native-sdk-v3'
/**
* Query Passio's web service for nutrition attributes given an package food identifier.
* @param packagedFoodCode - The code identifier for the attributes query, taken from the list of package food candidates on a `FoodDetectionEvent`.
* @returns A `Promise` resolving to a `PassioFoodItem` object if the record exists in the database or `null` if not.
*/
fetchFoodItemForProductCode(
code: Barcode | PackagedFoodCode
): Promise<PassioFoodItem | null>
Example
Its' return PassioFoodItem
const getFoodItem = async (code: Barcode | PackagedFoodCodeackagedFoodCode) => {
try {
const passioFoodItem = await PassioSDK.fetchFoodItemForProductCode(code)
} catch (error) {
console.log('error', error)
}
}
Last updated