fatsecret_nutrition 0.1.0+3 copy "fatsecret_nutrition: ^0.1.0+3" to clipboard
fatsecret_nutrition: ^0.1.0+3 copied to clipboard

A Dart package for interacting with the FatSecret Nutrition API

example/example.dart

import 'package:dotenv/dotenv.dart';
import 'package:fatsecret_nutrition/fatsecret_nutrition.dart';

void main() async {
  final env = DotEnv(includePlatformEnvironment: true)..load();
  final fatSecret = FatSecretNutrition(
    clientId: env['CLIENT_ID']!,
    clientSecret: env['CLIENT_SECRET']!,
    tokenUrl: env['TOKEN_URL']!,
    apiUrl: env['API_URL']!,
  );

  final items = (await fatSecret.autoComplete(
    const FoodAutoCompleteV2Props(
      expression: 'cheese',
    ),
  ))
      ?.suggestions
      .suggestion;

  print(items);

  final foods2 = await fatSecret.search(
    FoodSearchV3Props(
      searchExpression: items?.isNotEmpty ?? false ? items!.last : 'cheese',
      maxResults: 10,
      pageNumber: 2,
    ),
  );

  print(foods2);

  final foods3 = await fatSecret.foodFindIdForBarcode(
    const FoodForBarcodeProps(
      barcode: '9300675079655',
    ),
  );
  print(foods3);
}
1
likes
0
points
94
downloads

Publisher

verified publisherf3software.com

Weekly Downloads

A Dart package for interacting with the FatSecret Nutrition API

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

dio, dotenv, freezed_annotation, http, json_annotation, sortedmap

More

Packages that depend on fatsecret_nutrition