Scalar.integer constructor

Scalar.integer(
  1. BigInt value,
  2. DType dtype
)

Implementation

factory Scalar.integer(BigInt value, DType dtype) {
  final bounds = _integerBounds[dtype.kind];
  if (bounds == null) {
    throw ArgumentError.value(dtype, 'dtype', 'not an integer');
  }
  if (value < bounds.$1 || value > bounds.$2) {
    throw ArgumentError.value(
      value,
      'value',
      'must be between ${bounds.$1} and ${bounds.$2}',
    );
  }
  return Scalar._(dtype, {'value': value.toString()});
}