ProviderRegistry class

Enterprise-grade provider registry for managing multiple providers and their capabilities. Useful for applications that work with multiple LLM providers or need dynamic provider selection.

Constructors

ProviderRegistry.new()

Properties

hashCode int
The hash code for this object.
no setterinherited
isEmpty bool
Check if registry is empty
no setter
providerCount int
Get providers count
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

clear() → void
Clear all providers
findBestProvider(Set<LLMCapability> required, {Set<LLMCapability>? preferred}) String?
Find the best provider for a set of requirements Returns the provider with the most matching capabilities
findProvidersWithAllCapabilities(Set<LLMCapability> required) List<String>
Find providers that support all required capabilities
findProvidersWithCapability(LLMCapability capability) List<String>
Find providers that support a specific capability
getCapabilities(String providerId) Set<LLMCapability>
Get all capabilities for a provider
getCapabilityMatrix() Map<String, Set<LLMCapability>>
Get capability matrix for all providers
getProvider<T>(String id) → T?
Get a registered provider by ID
getProviderIds() List<String>
Get all registered provider IDs
getProviderInfo(String id) RegistryProviderInfo?
Get detailed provider information
getStats() RegistryStats
Get registry statistics
hasCapability(String providerId, LLMCapability capability) bool
Check if a provider supports a capability
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerProvider(String id, dynamic provider, {Map<String, dynamic>? metadata}) → void
Register a provider with optional metadata
toString() String
A string representation of this object.
inherited
unregisterProvider(String id) bool
Unregister a provider
validateAllProviders(Set<LLMCapability> required) Map<String, CapabilityValidationReport>
Validate all providers against requirements
withBestProvider<R>(Set<LLMCapability> required, Future<R> action(String providerId, dynamic provider), {Set<LLMCapability>? preferred}) Future<R?>
Execute action with the best available provider
withCapabilityProvider<T, R>(LLMCapability capability, Future<R> action(T provider)) Future<R?>
Execute action with capability-specific provider

Operators

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