ProtocolVersion constructor

ProtocolVersion(
  1. int value
)

Validates and creates a ProtocolVersion value.

Implementation

factory ProtocolVersion(int value) {
  if (value < 0) {
    throw const FormatException('Number is below the schema minimum');
  }
  if (value > 65535) {
    throw const FormatException('Number exceeds the schema maximum');
  }
  return ProtocolVersion._(value);
}