# canConvert method

1. @override

bool canConvert(

1. Class? sourceType,
2. Class targetType

)
override

Determines whether objects of `sourceType` can be converted to `targetType`.

This allows frameworks to optimize or validate before performing conversions.

### Example:

    if (conversionService.canConvert<String, DateTime>(Class<String>(), Class<DateTime>())) {
      final date = conversionService.convert<DateTime>('2025-01-01', Class<DateTime>());
    }

## Implementation

    @override
    bool canConvert(Class? sourceType, Class targetType) {
      if (sourceType == null) return true;
      return _getConverter(sourceType, targetType) != null;
    }