fetchAttributesForBarcode

Import

import {
  PassioSDK,
  type PassioFoodItem,
  type Barcode,
} from '@passiolife/nutritionai-react-native-sdk-v3'
 /**
   * Query Passio's UPC web service for nutrition attributes of a given barcode.
   * @param barcode - The barcode value for the attributes query, typically taken from a scanned `BarcodeCandidate`.
   * @returns A `Promise` resolving to a `PassioFoodItem` object if the record exists in the database or `null` if not.
   */
  fetchAttributesForBarcode(barcode: Barcode): Promise<oFoodItem | null>

Example

Its' return PassioFoodItem

const getFoodItem = async (barcode: Barcode) => {
  try {
    const passioFoodItem = await PassioSDK.fetchAttributesForBarcode(barcode)
  } catch (error) {
    console.log('error', error)
  }
}

Last updated