getProvider static method

FutureOr<DBConnectionProvider<DBConnection>?> getProvider(
  1. String type,
  2. DBConnectionCredential credential, {
  3. Duration retryInterval = const Duration(seconds: 1),
  4. int maxRetries = 10,
  5. int maxConnections = 1,
})

Gets a DBConnectionProvider for type with credential.

Implementation

static FutureOr<DBConnectionProvider?> getProvider(
    String type, DBConnectionCredential credential,
    {Duration retryInterval = const Duration(seconds: 1),
    int maxRetries = 10,
    int maxConnections = 1}) {
  type = type.toLowerCase().trim();

  var providerInstantiator = _registeredProviders[type];
  if (providerInstantiator == null) return null;

  var provider = providerInstantiator(credential,
      retryInterval: retryInterval,
      maxRetries: maxRetries,
      maxConnections: maxConnections);

  return provider;
}