glp-companion/lib/features/nutrition/data/datasources/remote_food_data_source.dart

13 lines
593 B
Dart

import '../../domain/entities/food_product.dart';
/// A remote product source consulted by the food search repository after the
/// local cache misses. Both the Open Food Facts client and the USDA
/// FoodData Central client implement it; unit tests inject fakes to verify
/// the cache -> OFF -> USDA fallback sequence.
abstract class RemoteFoodDataSource {
/// Resolves a free-text query to zero or more products.
Future<List<FoodProduct>> searchByText(String query);
/// Resolves a UPC/EAN barcode to zero or one product.
Future<List<FoodProduct>> lookupBarcode(String barcode);
}