openBestChoice method

Future<FetchedProduct> openBestChoice()

Implementation

Future<FetchedProduct> openBestChoice() async {
  final Product? product = await DaoProduct(localDatabase).get(barcode);
  if (product != null) {
    return FetchedProduct.found(product);
  }
  if (localDatabase.upToDate.hasPendingChanges(barcode)) {
    return FetchedProduct.found(Product(barcode: barcode));
  }
  return openUniqueProductSearch();
}