A factory for creating Converter instances that convert from a source type S
to a target type T, where T is a subtype of R.
This interface is useful when conversion logic needs to support multiple
target types derived from a common base type R.
🔧 Example Usage:
class StringToNumberConverterFactory implements ConverterFactory<String, num> {
@override
Converter<String, T> getConverter<T extends num>() {
if (T == int) {
return (IntStringConverter() as Converter<String, T>);
} else if (T == double) {
return (DoubleStringConverter() as Converter<String, T>);
}
throw ConversionException('No converter for type $T');
}
}
- Implemented types
- Implementers
- Annotations
-
- @Generic(ConverterFactory)
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
getConverter<
T> (Class< T> targetType) → Converter<S, T> ? -
A factory for creating Converter instances that convert from a source type
Sto a target typeT, whereTis a subtype ofR. -
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