FromBits static method

ByteSize FromBits(
  1. dynamic value
)

Returns a ByteSize object initialized by size in Bits.

var size = ByteSize.FromBits(10000);

Implementation

static ByteSize FromBits(dynamic value) {
  if (value is int) {
    return ByteSize(value / _BitsInByte);
  } else if (value is BigInt) {
    return ByteSize(value / BigInt.from(_BitsInByte));
  } else {
    throw FormatException('Invalid value');
  }
}