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 b = StringBuffer();
  b.writeln('ParametricInterval:');
  b.writeln('   name: $name');
  b.writeln('   current boundaries:');
  b.writeln('   start: ${startFunc()}');
  b.writeln('   end: ${endFunc()}');
  if (isDiscrete) {
    final gridPoints = this.gridPoints;
    b.write('   discrete: $levels levels: [');
    for (final gridPoint in gridPoints.take(2)) {
      b.write('${gridPoint.toStringAsPrecision(5)}, ');
    }
    if (levels > 2) {
      b.write('..., ${gridPoints.last.toStringAsPrecision(5)}];');
    } else {
      b.write('];');
    }
    b.write(' dx: ${dx().toStringAsPrecision(6)}\n');
  }
  if (_isUpToDate) {
    b.write('   cached next: $_cache');
  } else {
    b.write('   cached next: not set');
  }
  return b.toString();
}