nutrientfacts 0.0.7

  • Readme
  • Changelog
  • Example
  • Installing
  • 40

nutrientfacts #

Widget to render Nutrition Facts labels


Featuring: #

  • Full Nutrition Facts label rendering
  • Automatic missing values handling
  • Automatic Daily Value % calculation

Getting Started #

For help getting started with Flutter, view our online documentation.

For help on editing package code, view the documentation.

[0.0.7] #

  • Added support for Dart 2

[0.0.6] #

  • Meta data nutrient infromation moved to MetaDataNutrient class

[0.0.4] #

  • Fully operational Widget

[0.0.1] #

  • Initual layout made


import 'package:flutter/material.dart';
import 'package:nutrientfacts/nutrientfacts.dart';

final nutrientData = {
  "CA": {"amount": 37.5, "unit": "mg"},
  "CHOCDF": {"amount": 342.1, "unit": "g"},
  "CHOLE": {"amount": 16.561, "unit": "mg"},
  "ENERC_KCAL": {"amount": 2135.9, "unit": "kcal"},
  "FAT": {"amount": 67.51, "unit": "g"},
  "FE": {"amount": 18.2, "unit": "mg"},
  "FIBTG": {"amount": 12.90, "unit": "g"},
  "FOLAC": {"amount": 385.0, "unit": "mcg"},
  "K": {"amount": 676.7, "unit": "mg"},
  "MG": {"amount": 133.07, "unit": "mg"},
  "NA": {"amount": 1038.89, "unit": "mg"},
  "NIA": {"amount": 19.49, "unit": "mg"},
  "P": {"amount": 381.19, "unit": "mg"},
  "PROCNT": {"amount": 35.99, "unit": "g"},
  "RIBF": {"amount": 1.6, "unit": "mg"},
  "SE": {"amount": 84.75, "unit": "mcg"},
  "SUGAR": {"amount": 74.49, "unit": "g"},
  "THIA": {"amount": 2.74, "unit": "mg"},
  "VITA_IU": {"amount": 5.0, "unit": "IU"},
  "VITB6A": {"amount": 0.11, "unit": "mg"},
  "VITD": {"amount": 28.39, "unit": "IU"},
  "VITK1": {"amount": 0.75, "unit": "mcg"},
  "ZN": {"amount": 2.93, "unit": "mg"},
  "SATFAT": {"amount": 4.2, "unit": "g"},
  "TRANSFAT": {"amount": 4.2, "unit": "g"},
  "FIBER": {"amount": 4.23456, "unit": "g"},

void main() {
    debugShowCheckedModeBanner: false,
    theme: ThemeData.light(),
    title: "Nutritional Facts!",
    home: NutritionFacts(nutrientData: nutrientData),

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  nutrientfacts: ^0.0.7

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:nutrientfacts/nutrientfacts.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Apr 1, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Health suggestions

Fix lib/nutrientfacts.dart. (-3.45 points)

Analysis of lib/nutrientfacts.dart reported 7 hints, including:

line 196 col 18: Avoid using braces in interpolation when not needed.

line 196 col 24: Avoid using braces in interpolation when not needed.

line 204 col 50: Avoid using braces in interpolation when not needed.

line 244 col 30: Avoid using braces in interpolation when not needed.

line 244 col 36: Avoid using braces in interpolation when not needed.

Maintenance issues and suggestions

Homepage URL doesn't exist. (-20 points)

At the time of the analysis the homepage field was unreachable.

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (carousel_slider).

Package is getting outdated. (-63.01 points)

The package was last published 85 weeks ago.

The package description is too short. (-17 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.20.1 <3.0.0
carousel_slider ^0.0.6 0.0.7 1.4.1
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies