transformers property
Define any transformations for values. You can transform an enumeration to an int and the other way round:
transformers['my-enum'] = (value) => value is MySerializableEnum
? value.index
: MySerializableEnum.values[value];
You can also transform Map keys and Map or List values by using the
parent's key with .key appended, this is required when you have non-String keys in your Map:
// example for transformation of `int` keys of a map:
transformers['my-map.key'] = (value) => value is int ? value.toString() : int.parse(value);
Implementation
@override
Map<String, dynamic Function(dynamic)> get transformers => _transformers;