encoder method
The mapping method to encode value
to a serializable value.
Implementation
@override
Object? encoder(T value, EncodingContext context) {
if (hook != null) {
var result = hook!.beforeEncode(value);
if (result is! T) {
return hook!.afterEncode(result);
}
value = result;
}
var result = encode(value, context);
if (hook != null) {
result = hook!.afterEncode(result);
}
return result;
}