get<T> method
return an object given the desired type
T the generic type
type optional type for calls where a generic type is not available
Implementation
T get<T>({Type? type}) {
final lookup = type ?? T;
final provider = providers[lookup];
if (provider == null) {
throw DIRuntimeException('$lookup is not supported');
}
return provider.create(this) as T;
}