registerEntry method
- @protected
- String name,
- SessionDriverRegistration value, {
- bool overrideExisting = true,
inherited
Registers an entry with the given name and value.
If overrideExisting is true, an existing entry with the same name
will be replaced. Returns true if the entry was successfully registered.
Throws an ArgumentError if the name is empty.
Implementation
@protected
bool registerEntry(String name, V value, {bool overrideExisting = true}) {
final key = normalizeName(name);
if (key.isEmpty) {
throw ArgumentError.value(name, 'name', 'Registry key cannot be empty.');
}
final existing = _entries[key];
if (existing != null) {
final shouldOverride = onDuplicate(key, existing, overrideExisting);
if (!shouldOverride) {
return false;
}
}
_entries[key] = value;
_origins[key] = StackTrace.current;
return true;
}