ConversionServiceConverter<S, T> class
A Converter that delegates to a ConversionService for converting values.
This wrapper allows a ConversionService to be plugged into APIs that require a Converter, using a fixed target type.
π§ Example:
final service = DefaultConversionService();
final converter = ConversionServiceConverter<String, int>(service, Class<int>());
final result = converter.convert("123");
print(result); // 123
Throws ConversionException if the conversion fails or returns null
.
- Implemented types
-
- Converter<
S, T>
- Converter<
- Annotations
-
- @Generic.new(ConversionServiceConverter)
Constructors
-
ConversionServiceConverter(ConversionService _conversionService, Class<
T> targetType) - A Converter that delegates to a ConversionService for converting values.
Properties
- hashCode β int
-
The hash code for this object.
no setterinherited
- runtimeType β Type
-
A representation of the runtime type of the object.
no setterinherited
-
targetType
β Class<
T> -
final
Methods
-
convert(
S source) β T -
A generic interface for converting an input of type
S
into an output of typeT
.override -
getPackageName(
) β String -
Represents an abstraction for identifying the package that an object,
resource, or service belongs to.
inherited
-
noSuchMethod(
Invocation invocation) β dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) β String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) β bool -
The equality operator.
inherited