compactToBn function

BigInt compactToBn(
  1. Map<String, dynamic> value
)

Implementation

BigInt compactToBn(Map<String, dynamic> value) {
  final toBnTrue = value.containsKey('toBn') && value['toBn'] is Function;
  final toBigIntTrue =
      value.containsKey('toBigInt') && value['toBigInt'] is Function;
  if (toBnTrue && !toBigIntTrue) {
    return (value['toBn'] as Function).call();
  }
  if (!toBnTrue && toBigIntTrue) {
    return (value['toBigInt'] as Function).call();
  }
  throw UnreachableError();
}