generateCounterContent method

String generateCounterContent(
  1. int count
)

Generates content using the algorithm of this CounterStyle, applying padding and negative signs as necessary. Does not apply prefix or suffix.

Implementation

String generateCounterContent(int count) {
  if (!_range.withinRange(count)) {
    return CounterStyleRegistry.lookup(_fallbackStyle)._algorithm(count);
  }

  final initialCounterContent = _algorithm(count.abs());

  if (count < 0 && _usesNegative) {
    final padded = initialCounterContent.padLeft(
        _padLength - _negative.length, _padCharacter);
    return '$_negative$padded';
  }

  final padded = initialCounterContent.padLeft(_padLength, _padCharacter);
  return padded;
}