MapToStringGenericConverter class
A converter that transforms different types of Map into a String.
This class supports conversion from:
Map→StringHashMap→Stringcol.HashMap→String
The resulting string is a comma-separated list of key-value pairs
where each pair is joined by an equals sign (=).
Example:
final service = ConversionService(); // Your implementation
final converter = MapToStringGenericConverter(service);
final input = {"name": "John", "age": 30, "country": "USA"};
final result = converter.convert(
input,
Class<Map>(null, PackageNames.DART),
STRING,
);
print(result); // name=John, age=30, country=USA
Key & Value Conversion
If the source map specifies key and value types, they will be converted
to String using the provided ConversionService.
- Inheritance
-
- Object
- PairedConverter
- PairedConditionalConverter
- MapToStringGenericConverter
Constructors
- MapToStringGenericConverter(ConversionService _conversionService)
- A converter that transforms different types of Map into a String.
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
-
convert<
T> (Object? source, Class sourceType, Class targetType) → Object? -
A general-purpose converter that can convert between multiple source–target type pairs.
override
-
getConvertibleTypes(
) → Set< ConvertiblePair> ? -
A general-purpose converter that can convert between multiple source–target type pairs.
override
-
getPackageName(
) → String -
Represents an abstraction for identifying the package that an object,
resource, or service belongs to.
inherited
-
matches(
Class sourceType, Class targetType) → bool -
A contract for a converter that only matches under certain conditions.
override
-
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