formatBitrate static method

String formatBitrate(
  1. int bitrate
)

Implementation

static String formatBitrate(int bitrate) {
  if (bitrate < 1000) {
    return "$bitrate bit/s";
  }
  if (bitrate < 1000000) {
    final kbit = (bitrate / 1000).floor();
    return "~$kbit KBit/s";
  }
  final mbit = (bitrate / 1000000).floor();
  return "~$mbit MBit/s";
}