encodeFromBigInt static method

Uint8List encodeFromBigInt(
  1. BigInt value
)

Implementation

static Uint8List encodeFromBigInt(BigInt value) {
  if (value.sign == -1) {
    throw Exception('UintType can\'t encode negative value $value');
  }

  final bytes = bigIntToBytesUnsigned(value);
  final result = Uint8List(32);
  result.setAll(32 - bytes.lengthInBytes, bytes);
  return result;
}