toString method

  1. @override
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

@override
String toString() {
  final $buf = StringBuffer()..writeln('Discount(');
  if (checkoutSession != null) {
    $buf
      ..writeln()
      ..write('  checkout_session: ')
      ..write(checkoutSession)
      ..write(',');
  }
  $buf
    ..writeln()
    ..write('  coupon: ')
    ..write(coupon)
    ..write(',');
  if (customer != null) {
    $buf
      ..writeln()
      ..write('  customer: ')
      ..write(customer)
      ..write(',');
  }
  if (end != null) {
    $buf
      ..writeln()
      ..write('  end: ')
      ..write(end)
      ..write(',');
  }
  $buf
    ..writeln()
    ..write('  id: ')
    ..write(id)
    ..write(',');
  if (invoice != null) {
    $buf
      ..writeln()
      ..write('  invoice: ')
      ..write(invoice)
      ..write(',');
  }
  if (invoiceItem != null) {
    $buf
      ..writeln()
      ..write('  invoice_item: ')
      ..write(invoiceItem)
      ..write(',');
  }
  $buf
    ..writeln()
    ..write('  object: ')
    ..write(object)
    ..write(',');
  if (promotionCode != null) {
    $buf
      ..writeln()
      ..write('  promotion_code: ')
      ..write(promotionCode)
      ..write(',');
  }
  $buf
    ..writeln()
    ..write('  start: ')
    ..write(start)
    ..write(',');
  if (subscription != null) {
    $buf
      ..writeln()
      ..write('  subscription: ')
      ..write(subscription)
      ..write(',');
  }
  $buf.write(')');
  return $buf.toString();
}