viewService<T> method
ViewService retrieves a service-specific scope.
Implementation
@override
Future<T> viewService<T>(String serviceName, Future<T> Function(ServiceScope scope) f) async {
final scope = getServiceScopeInternal(serviceName);
// This requires ServiceScopeImpl to implement ServiceScope and extend ResourceScopeImpl
try {
// The cast is now valid as getServiceScopeInternal returns ServiceScopeImpl
return await f(scope);
} finally {
// Ref counting considerations remain.
}
}