getInstance<T> method
T
getInstance<T>([
- Spec? spec
Implementation
T getInstance<T>([Spec? spec]) {
var instances = getInstances<T>(spec);
if (instances.length > 1) {
throw StateError(
'Multiple definitions found for ${spec != null ? '($spec)' : ''}');
}
if (instances.isEmpty) {
throw ArgumentError(
'No factory registered for $T${spec != null ? '($spec)' : ''}');
}
return instances.first;
}