ConditionalConverter class abstract interface

A contract for a converter that only matches under certain conditions.

This is useful in frameworks where type conversion should occur only if some custom logic (e.g., annotations, context, runtime checks) validates it.

You can implement this interface when you want to provide more granular control over when a converter should be applied.


πŸ”§ Example:

class MyConditionalConverter implements ConditionalConverter {
  @override
  bool matches(Class sourceType, Class targetType) {
    return sourceType.getType() == String && targetType.getType() == Uri;
  }
}
Implementers

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

matches(Class sourceType, Class targetType) β†’ bool
A contract for a converter that only matches under certain conditions.
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