download method
Downloads the product. To be used as a refresh after a network issue.
Implementation
Future<void> download() async {
_safeNotifyListeners(ProductLoadingStatus.DOWNLOADING);
final FetchedProduct fetchedProduct = await BarcodeProductQuery(
barcode: barcode,
daoProduct: _daoProduct,
isScanned: false,
).getFetchedProduct();
if (fetchedProduct.status == FetchedProductStatus.ok) {
_databaseProduct = fetchedProduct.product;
_safeNotifyListeners(ProductLoadingStatus.LOADED);
return;
}
_loadingError = fetchedProduct;
_safeNotifyListeners(ProductLoadingStatus.ERROR);
}