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('CouponCreateOptions(');
  if (amountOff != null) {
    $buf
      ..writeln()
      ..write('  amount_off: ')
      ..write(amountOff)
      ..write(',');
  }
  if (appliesTo != null) {
    $buf
      ..writeln()
      ..write('  applies_to: ')
      ..write(appliesTo)
      ..write(',');
  }
  if (currency != null) {
    $buf
      ..writeln()
      ..write('  currency: ')
      ..write(currency)
      ..write(',');
  }
  if (currencyOptions != null) {
    $buf
      ..writeln()
      ..write('  currency_options: ')
      ..write(currencyOptions)
      ..write(',');
  }
  if (duration != null) {
    $buf
      ..writeln()
      ..write('  duration: ')
      ..write(duration)
      ..write(',');
  }
  if (durationInMonths != null) {
    $buf
      ..writeln()
      ..write('  duration_in_months: ')
      ..write(durationInMonths)
      ..write(',');
  }
  if (expand != null) {
    $buf
      ..writeln()
      ..write('  expand: ')
      ..write(expand)
      ..write(',');
  }
  if (id != null) {
    $buf
      ..writeln()
      ..write('  id: ')
      ..write(id)
      ..write(',');
  }
  if (maxRedemptions != null) {
    $buf
      ..writeln()
      ..write('  max_redemptions: ')
      ..write(maxRedemptions)
      ..write(',');
  }
  if (metadata != null) {
    $buf
      ..writeln()
      ..write('  metadata: ')
      ..write(metadata)
      ..write(',');
  }
  if (name != null) {
    $buf
      ..writeln()
      ..write('  name: ')
      ..write(name)
      ..write(',');
  }
  if (percentOff != null) {
    $buf
      ..writeln()
      ..write('  percent_off: ')
      ..write(percentOff)
      ..write(',');
  }
  if (redeemBy != null) {
    $buf
      ..writeln()
      ..write('  redeem_by: ')
      ..write(redeemBy)
      ..write(',');
  }
  $buf.write(')');
  return $buf.toString();
}