formatByteLine static method
Formatter for showBytes
Implementation
@visibleForTesting
// ignore: library_private_types_in_public_api
static _ProgressByteUpdate formatByteLine(FetchProgress progress) {
  _ProgressByteUpdate update;
  final status = _fixedWidthStatus(progress.status);
  final downloaded = Format().bytesAsReadable(progress.downloaded);
  final total = Format().bytesAsReadable(progress.length, pad: false);
  final url = Format().limitString(progress.fetch.url);
  switch (progress.status) {
    case FetchStatus.initialising:
      update = _ProgressByteUpdate(0, '$status      ?/?      $url');
      break;
    case FetchStatus.connected:
    case FetchStatus.connecting:
    case FetchStatus.headers:
    case FetchStatus.response:
    case FetchStatus.error:
      update = _ProgressByteUpdate(0, '$status      ?/?      $url');
      break;
    case FetchStatus.downloading:
      if (progress.prior?.status == FetchStatus.downloading) {
        update = _ProgressByteUpdate(14, '$downloaded/$total');
      } else {
        update = _ProgressByteUpdate(0, '$status $downloaded/$total');
      }
      break;
    case FetchStatus.complete:
      update =
          _ProgressByteUpdate(0, '$status $downloaded/$total', newline: true);
      break;
  }
  return update;
}