toString method
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, {bool? isOriginal}) {
if (value != null) {
if(isOriginal == true) {
parts.add("$key: $value");
} else {
// String formattedValue = value is String ? "'${value.replaceAll("'", "\\'")}'" : value.toString(
String formattedValue = value is String ? "'${value.queryReplace()}'" : value.toString();
parts.add("$key: $formattedValue");
}
}
}
addPart('application_id', getApplicationId());
addPart('pg', pg);
addPart('method', getMethodValue(), isOriginal: true);
addPart('order_name', orderName);
addPart('price', price);
addPart('tax_free', taxFree);
addPart('deposit_price', depositPrice);
addPart('order_id', orderId);
addPart('subscription_id', subscriptionId);
addPart('authentication_id', authenticationId);
addPart('metadata', getMetadataStringAndroid(), isOriginal: true);
addPart('user_token', userToken);
addPart('extra', extra.toString(), isOriginal: true);
addPart('user', user.toString(), isOriginal: true);
addPart('items', getItems(), isOriginal: true);
addPart('use_terms', widgetUseTerms);
addPart('sandbox', widgetSandbox);
// addPart('widget_sandbox', widgetSandbox);
addPart('key', widgetKey);
if(widgetKey != null) {
addPart("widget", 1);
addPart('use_bootpay_inapp_sdk', true);
}
addPart('oopay', widgetOopay?.toJson(), isOriginal: true);
addPart('currency', currency);
addPart('wallet_id', _widgetWalletId);
addPart('terms', getSelectTermsValue(), isOriginal: true);
// addPart('select_terms', getSelectTermsValue(), isOriginal: true);
return "{${parts.join(", ")}}";
}