asBigInt<T> method

T asBigInt<T>(
  1. String key
)

Implementation

T asBigInt<T>(String key) {
  final value = this[key];
  if (value == null) {
    if (null is T) {
      return null as T;
    }
    throw DartSuiPluginException(
      'Key not found.',
      details: {'key': key, 'data': this},
    );
  }
  try {
    return BigintUtils.parse(value) as T;
  } on TypeError {
    throw DartSuiPluginException(
      'Incorrect value.',
      details: {
        'key': key,
        'expected': '$T',
        'value': value.runtimeType,
        'data': this,
      },
    );
  }
}