toString method

String toString()
override

A string representation of this object.

Some classes have a default textual representation, often paired with a static parse function (like int.parse). These classes will provide the textual representation as their string representation.

Other classes have no meaningful textual representation that a program will care about. Such classes will typically override toString to provide useful information when inspecting the object, mainly for debugging or logging.

Implementation

String toString() {

  List<String> parts = [];

  void addPart(String key, dynamic value) {
    if (value != null) {
      String formattedValue = value is String ? "'${value.replaceAll("'", "\\'")}'" : value.toString();
      parts.add("$key: $formattedValue");
    }
  }

  void addPartList(String key, List<dynamic>? value) {
    if (value == null) return;
    if (value.isEmpty) return;
    if (value is List<String>) {
      String formattedValue = value.map((e) => "'$e'").join(",");
      parts.add("$key: [$formattedValue]");
    } else if (value is List<BrowserOpenType>) {
      String formattedValue = value.map((e) => e.toString()).join(",");
      parts.add("$key: [$formattedValue]");
    }
  }

  addPart('card_quota', cardQuota ?? '0');
  addPart('seller_name', sellerName);
  addPart('delivery_day', deliveryDay);
  addPart('locale', locale);
  addPart('offer_period', offerPeriod);
  addPart('display_cash_receipt', displayCashReceipt);
  addPart('deposit_expiration', depositExpiration);
  addPart('app_scheme', appScheme);
  addPart('use_card_point', useCardPoint);
  addPart('direct_card_company', directCardCompany);
  if(directCardCompany != null && directCardCompany!.isNotEmpty) {
    addPart('direct_card_quota', directCardQuota ?? '0');
  }
  // addPart('direct_card_quota', directCardQuota ?? '0');
  // addPart('direct_card_quota', directCardQuota);
  addPart('use_order_id', useOrderId);
  addPart('international_card_only', internationalCardOnly);
  addPart('phone_carrier', phoneCarrier);

  addPart('direct_samsungpay', directSamsungpay);
  addPart('test_deposit', testDeposit);
  addPart('enable_error_webhook', enableErrorWebhook);
  addPart('separately_confirmed', separatelyConfirmed);
  addPart('confirm_only_rest_api', confirmOnlyRestApi);
  addPart('open_type', openType);
  addPart('use_bootpay_inapp_sdk', useBootpayInappSdk);
  addPart('redirect_url', redirectUrl);
  addPart('display_success_result', displaySuccessResult);
  addPart('display_error_result', displayErrorResult);
  // addPart('disposable_cup_deposit', disposableCupDeposit);
  addPart('use_welcomepayment', useWelcomepayment);
  addPart('first_subscription_comment', firstSubscriptionComment);

  addPartList('browser_open_type', browserOpenType);
  addPartList('enable_card_companies', enableCardCompanies);
  addPartList('enable_easy_payments', enableEasyPayments);
  addPartList('except_card_companies', exceptCardCompanies);



  addPart('confirm_grace_seconds', confirmGraceSeconds);
  addPart('age_limit', ageLimit);
  addPart('subscribe_test_payment', subscribeTestPayment);
  addPart('timeout', timeout);
  addPart('escrow', escrow);
  addPart('show_close_button', showCloseButton);
  addPart('common_event_webhook', commonEventWebhook);
  addPart('delivery_price', deliveryPrice);
  addPart('use_extra_deduction', useExtraDeduction);
  addPart('direct_card_interest', directCardInterest);

  addPart('easy_payment_method', easyPaymentMethod);
  addPart('cash_receipt_type', cashReceiptType);
  addPart('identity_no', identityNo);
  addPart('subscription_comment', subscriptionComment);

  return "{${parts.join(',')}}";
}