getRequired<TService> method
TService
getRequired<TService>()
Gets a service of the specified type. Throws an exception if no service of the specified type is registered.
Implementation
TService getRequired<TService>() {
final service = get<TService>();
if (service == null) {
throw Exception('No service registered for type $TService');
}
return service;
}