ConnectionId constructor

ConnectionId(
  1. List<int> bytes
)

Creates a ConnectionId from a list of bytes.

Throws an ArgumentError if the length of bytes is not within the valid range minCidLength, maxCidLength.

Implementation

ConnectionId(List<int> bytes) : _bytes = Uint8List.fromList(bytes) {
  if (_bytes.length < minCidLength || _bytes.length > maxCidLength) {
    throw ArgumentError(
      'ConnectionId must be between $minCidLength and $maxCidLength bytes long, got ${_bytes.length}');
  }
}