StreamPosition.checked constructor

StreamPosition.checked(
  1. int value
)

Constructs a new StreamPosition from given value.

Implementation

factory StreamPosition.checked(int value) {
  if (value == -1) {
    return end;
  }
  final version = Int64(value);
  if (version > Int64.MAX_VALUE && version != Int64.MAX_VALUE) {
    throw ArgumentOutOfRangeException.fromCause(GrpcError.outOfRange(
      'Revision value can not be large than Int64.MAX_VALUE',
    ));
  }
  return StreamPosition._(version);
}