decoder method

  1. @override
T decoder(
  1. Object? value,
  2. DecodingContext context
)
override

The mapping method to decode value to an instance of this mappers type.

Implementation

@override
T decoder(Object? value, DecodingContext context) {
  if (hook != null) {
    value = hook!.beforeDecode(value);

    if (value is T) {
      return hook!.afterDecode(value) as T;
    }
  }

  var result = decode(value, context);

  if (hook != null) {
    result = hook!.afterDecode(result) as T;
  }

  return result;
}