viewService<T> method

  1. @override
Future<T> viewService<T>(
  1. String serviceName,
  2. Future<T> f(
    1. ServiceScope scope
    )
)
override

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.
  }
}