replaceVersionBytes function

Uint8List replaceVersionBytes(
  1. List<int> bytes,
  2. Version target
)

Implementation

Uint8List replaceVersionBytes(List<int> bytes, Version target) {
  if (bytes.length < 4) {
    throw ArgumentException.invalidLength(
        "Expected byte length: 4, Found: ${bytes.length}");
  }
  bytes.replaceRange(0, 4, target.bytes);
  return Uint8List.fromList(bytes);
}