debugFillDescription method

  1. @mustCallSuper
void debugFillDescription(
  1. List<String> description
)

Add additional information to the given description for use by toString.

This method makes it easier for subclasses to coordinate to provide a high-quality toString implementation. The toString implementation on the ScrollController base class calls debugFillDescription to collect useful information from subclasses to incorporate into its return value.

Implementations of this method should start with a call to the inherited method, as in super.debugFillDescription(description).

Implementation

@mustCallSuper
void debugFillDescription(List<String> description) {
  if (debugLabel != null) {
    description.add(debugLabel!);
  }
  if (initialScrollOffset != 0.0) {
    description.add('initialScrollOffset: ${initialScrollOffset.toStringAsFixed(1)}, ');
  }
  if (_positions.isEmpty) {
    description.add('no clients');
  } else if (_positions.length == 1) {
    // Don't actually list the client itself, since its toString may refer to us.
    description.add('one client, offset ${offset.toStringAsFixed(1)}');
  } else {
    description.add('${_positions.length} clients');
  }
}