parseBigInt<T> static method

T parseBigInt<T>({
  1. required Object? value,
  2. required String name,
})

Implementation

static T parseBigInt<T>({required Object? value, required String name}) {
  if (BigInt.one is! T) {
    throw const TronPluginException(
        "Invalid type casting for BigInt parser.");
  }
  if (value == null && null is T) return null as T;
  if (value == null) {
    throw TronPluginException("Missing parameter: $name.");
  }

  final parse = BigintUtils.tryParse(value);
  if (parse != null) {
    return parse as T;
  }
  throw TronPluginException("Invalid BigInt value for parameter: $name.");
}