openError method Null safety
- dynamic fetchedProduct
Opens an error dialog; to be used only if the status is not ok.
Implementation
void openError(final FetchedProduct fetchedProduct) {
final AppLocalizations appLocalizations = AppLocalizations.of(context);
switch (fetchedProduct.status) {
case FetchedProductStatus.ok:
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);
return;
case FetchedProductStatus.internetNotFound:
_openProductNotFoundDialog();
return;
}
}