valueAsBigInt<T extends BigInt?> static method

T valueAsBigInt<T extends BigInt?>(
  1. Object? value, {
  2. bool allowHex = false,
})

Implementation

static T valueAsBigInt<T extends BigInt?>(Object? value,
    {bool allowHex = false}) {
  if (value is T) return value;
  if (value == null && _isNull<T>()) return null as T;
  final toBigint = BigintUtils.tryParse(value, allowHex: allowHex);
  if (toBigint == null) {
    throw JSONHelperException("Failed to parse value as bigint.");
  }
  return toBigint as T;
}