onDuplicate method

  1. @override
bool onDuplicate(
  1. String name,
  2. GateCallback 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, GateCallback existing, bool overrideExisting) {
  if (!overrideExisting) {
    return false;
  }
  throw GateRegistrationException('Ability "$name" is already registered.');
}