checkParameters method

String? checkParameters(
  1. BuildContext context
)

Returns the error message of the parameter check, or null if OK.

Implementation

String? checkParameters(BuildContext context) {
  final AppLocalizations appLocalizations = AppLocalizations.of(context);
  if (proof == null) {
    if (cropParameters == null) {
      return appLocalizations.prices_proof_mandatory;
    }
    if (location == null) {
      return appLocalizations.prices_location_mandatory;
    }
  }

  for (final PriceAmountModel priceAmountModel in _priceAmountModels) {
    final String? checkParameters = priceAmountModel.checkParameters(context);
    if (checkParameters != null) {
      return checkParameters;
    }
  }

  final UserPreferences userPreferences = context.read<UserPreferences>();
  unawaited(userPreferences.setUserCurrencyCode(currency.name));

  return null;
}