getRequiredServiceFromType method

Object getRequiredServiceFromType(
  1. Type serviceType
)

Get service of type serviceType from the ServiceProvider.

Implementation

Object getRequiredServiceFromType(Type serviceType) {
  if (this is SupportRequiredService) {
    return (this as SupportRequiredService).getRequiredService(serviceType);
  }

  var service = getServiceFromType(serviceType);
  if (service == null) {
    throw InvalidOperationException(
      message: 'No service for type \'${serviceType.runtimeType.toString()}\''
          ' has been registered.',
    );
  }

  return service;
}