# forMethodReturnTypeWithImplementation static method

ResolvableType forMethodReturnTypeWithImplementation(

1. MethodDeclaration method,
2. Type implementationClass

)

Creates a ResolvableType for a method's return type with implementation context.

This factory method creates a ResolvableType for a method's return type that considers a specific implementation class context. This is useful when the return type needs to be resolved in the context of a concrete implementation rather than the declaring class.

Parameters:

- `method`: The MethodDeclaration to get the return type from
- `implementationClass`: The implementation class Type to provide context

Returns:

- ResolvableType representing the return type in the implementation context

Example:

    abstract class Repository<T> {
      T findById(String id);
      List<T> findAll();
    }

    class UserRepository extends Repository<User> {
      // findById returns User, findAll returns List<User>
    }

    final findByIdMethod = getMethodDeclaration(Repository, 'findById');
    final findAllMethod = getMethodDeclaration(Repository, 'findAll');

    // Without implementation context - returns T and List<T>
    final genericFindByIdType = ResolvableType.forMethodReturnType(findByIdMethod);
    final genericFindAllType = ResolvableType.forMethodReturnType(findAllMethod);

    // With implementation context - returns User and List<User>
    final concreteFindByIdType = ResolvableType.forMethodReturnTypeWithImplementation(
      findByIdMethod,
      UserRepository
    );
    final concreteFindAllType = ResolvableType.forMethodReturnTypeWithImplementation(
      findAllMethod,
      UserRepository
    );

    print(concreteFindByIdType.resolve()?.getType()); // User
    print(concreteFindAllType.resolve()?.getType()); // List<User>
    print(concreteFindAllType.getGeneric().resolve()?.getType()); // User

## Implementation

    static ResolvableType forMethodReturnTypeWithImplementation(MethodDeclaration method, Type implementationClass) {
      final owner = forType(implementationClass);
      final resolver = owner.asVariableResolver();
      return forTypeWithProviderAndResolver(method.getReturnType().getType(), _MethodReturnTypeProvider(method), resolver);
    }