MapToMapGenericConverter class
A converter that transforms a Map (or any map-like type) into another Map type, optionally converting keys and values.
This class supports conversions between:
Map,HashMap,col.HashMap→ Any of the above
Example
final service = ConversionService(); // Your implementation
final converter = MapToMapGenericConverter(service);
final input = {"name": "John", "age": "30"};
final result = converter.convert(
input,
Class<Map>(null, PackageNames.DART),
Class<HashMap>(null, PackageNames.LANG),
);
print(result.runtimeType); // HashMap<dynamic, dynamic>
Key & Value Conversion
If the source and target maps specify types for keys and values, this converter will use the ConversionService to transform them.
- Inheritance
-
- Object
- PairedConverter
- PairedConditionalConverter
- MapToMapGenericConverter
Constructors
- MapToMapGenericConverter(ConversionService _conversionService)
- A converter that transforms a Map (or any map-like type) into another Map type, optionally converting keys and 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
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