SpotKey<T> class

Registry key that supports both unnamed and named service registration.

SpotKey allows registering multiple implementations of the same type by differentiating them with an optional name qualifier.

When name is null, the key represents the default/unnamed instance. When name is provided, it creates a named instance that can coexist with other implementations of the same type.

Example:

// Register multiple HTTP clients
final publicKey = SpotKey<HttpClient>(HttpClient, 'public');
final authKey = SpotKey<HttpClient>(HttpClient, 'authenticated');
final defaultKey = SpotKey<HttpClient>(HttpClient);  // name = null

Constructors

SpotKey(Type type, [String? name])
Creates a registry key for service lookup.
const

Properties

hashCode int
The hash code for this object.
no setteroverride
name String?
Optional name qualifier for named instances
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
type Type
The type being registered
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
override