encoder method

  1. @override
Object? encoder(
  1. DocumentModel value,
  2. EncodingContext context
)
inherited

The mapping method to encode value to a serializable value.

Implementation

@override
Object? encoder(T value, EncodingContext context) {
  if (superHook != null) {
    var result = superHook!.beforeEncode(value);

    if (result is! T) {
      return superHook!.afterEncode(result);
    }
    value = result;
  }

  var result = super.encoder(value, context);

  if (superHook != null) {
    result = superHook!.afterEncode(result);
  }

  return result;
}