render method

  1. @override
String render()
override

Renders the component as a string.

Implementation

@override
String render() {
  final progress = total > 0 ? (current / total).clamp(0.0, 1.0) : 0.0;
  final filled = (progress * width).round();
  final empty = width - filled;

  final bar = '${fillChar * filled}${emptyChar * empty}';
  final output = showPercentage
      ? '$bar ${(progress * 100).toStringAsFixed(0)}%'
      : bar;

  return output;
}