instance property

T instance

Retrieve the instance of Paymongo to access private or public APIs.

Implementation

T get instance {
  final keyType = _key.split('_').first;
  if (keyType.contains(privateKey)) {
    return (PaymongoSecret()
      ..key = _key
      ..url = _url) as T;
  } else if (keyType.contains(publicKey)) {
    return (PaymongoPublic()
      ..key = _key
      ..url = _url) as T;
  } else if (_sdk != null) {
    return _sdk!;
  }
  throw PaymongoError("Key does not match with private or secret key");
}