# isRequired method

1. @protected

bool isRequired(

1. DependencyDescriptor descriptor

)

Checks if a dependency is required.

This method determines whether a dependency must be resolved or if it can be omitted. Optional dependencies and nullable types are not required.

`descriptor` the dependency descriptor to check

Returns `true` if the dependency is required, `false` otherwise

## Implementation

    @protected
    bool isRequired(DependencyDescriptor descriptor) {
      // Check if dependency is required (not Optional, not nullable)
      return !Class<Optional>(null, PackageNames.LANG).isAssignableFrom(descriptor.type) || descriptor.isRequired;
    }