# forMethodReturnType static method

ResolvableType forMethodReturnType(

1. MethodDeclaration method

)

Creates a ResolvableType for a method's return type.

This factory method creates a ResolvableType representing the return type of a method declaration. This is useful for reflection-based operations where you need to work with method return types.

Parameters:

- `method`: The MethodDeclaration to get the return type from

Returns:

- ResolvableType representing the method's return type

Example:

    class UserService {
      List<User> getUsers() { ... }
      User? findUser(String id) { ... }
      void deleteUser(String id) { ... }
    }

    final getUsersMethod = getMethodDeclaration(UserService, 'getUsers');
    final findUserMethod = getMethodDeclaration(UserService, 'findUser');
    final deleteUserMethod = getMethodDeclaration(UserService, 'deleteUser');

    final getUsersReturnType = ResolvableType.forMethodReturnType(getUsersMethod);
    final findUserReturnType = ResolvableType.forMethodReturnType(findUserMethod);
    final deleteUserReturnType = ResolvableType.forMethodReturnType(deleteUserMethod);

    print(getUsersReturnType.resolve()?.getType()); // List<User>
    print(getUsersReturnType.hasGenerics()); // true
    print(getUsersReturnType.getGeneric().resolve()?.getType()); // User

    print(findUserReturnType.resolve()?.getType()); // User?
    print(deleteUserReturnType.resolve()?.getType()); // void

## Implementation

    static ResolvableType forMethodReturnType(MethodDeclaration method) {
      final typeProvider = _MethodReturnTypeProvider(method);
      return forTypeWithProviderAndResolver(method.getReturnType().getType(), typeProvider, null);
    }