transform method
dynamic
transform(
- dynamic value
Transforms a field value using the appropriate transformer registered for its type.
Parameters:
value
The field value to be transformed.
Returns: The transformed value, or the original value if no transformer is registered for its type.
Implementation
dynamic transform(dynamic value) {
final transformer = factories[value.runtimeType];
// If no transformer is found, check if there is a transformer for the base type
if (transformer == null && value is Iterable) {
// Handle cases where the runtime type might be a collection type like Set or List
if (value is Set) {
return _transformCollection<Set>(value);
} else if (value is List) {
return _transformCollection<List>(value);
}
}
return transformer?.transform(value);
}