formatBytes method Null safety

String formatBytes(
  1. {String formatBytes(
    1. num v,
    2. int power
    ) = _Numbers._defaultFormatBytes}
)

Implementation

String formatBytes(
    {String formatBytes(num v, int power) = _Numbers._defaultFormatBytes}) {
  var bytes = this;
  if (bytes <= 0) return formatBytes(0, 0);
  var i = (log(bytes) / log(1024)).floor();
  var b = ((bytes / pow(1024, i)));
  return formatBytes(b, i);
}