# convert<T> abstract method

T? convert<T>(

1. Object? source,
2. Class<T> targetType, [
3. String? qualifiedName

])

Converts the given `source` object to the specified `targetType`.

Returns `null` if the conversion fails or if `source` is `null`.

### Example:

    final port = conversionService.convert<int>('8080', Class<int>());
    final date = conversionService.convert<DateTime>('2025-01-01', Class<DateTime>());

    final port = conversionService.convert<int>('8080', Class<int>(), 'dart.core.int');
    final date = conversionService.convert<DateTime>('2025-01-01', Class<DateTime>(), 'dart.core.DateTime');

The `T` type parameter represents the expected return type.

## Implementation

    T? convert<T>(Object? source, Class<T> targetType, [String? qualifiedName]);