onDuplicate method

  1. @override
bool onDuplicate(
  1. String name,
  2. StorageDriverRegistration existing,
  3. bool overrideExisting
)

Handles duplicate entries with the given name and existing value.

Returns true if the existing entry should be overridden.

Implementation

@override
bool onDuplicate(
  String name,
  StorageDriverRegistration existing,
  bool overrideExisting,
) {
  if (!overrideExisting) {
    return false;
  }
  throw ProviderConfigException(
    'Storage driver "$name" is already registered.'
    '${duplicateDiagnostics(name)}',
  );
}