openError method
- FetchedProduct fetchedProduct
Opens an error dialog; to be used only if the status is not ok.
Implementation
void openError(FetchedProduct fetchedProduct) {
final AppLocalizations appLocalizations = AppLocalizations.of(context);
switch (fetchedProduct.status) {
case FetchedProductStatus.ok:
if (!fetchedProduct.isValid) {
_openProductNotFoundDialog();
return;
}
throw Exception("You're not supposed to call this if the status is ok");
case FetchedProductStatus.userCancelled:
return;
case FetchedProductStatus.internetError:
_openErrorMessage(
appLocalizations.product_internet_error_modal_message(
fetchedProduct.exceptionString ?? '-',
),
);
return;
case FetchedProductStatus.internetNotFound:
_openProductNotFoundDialog();
return;
}
}