decoder method

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

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

Implementation

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

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

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

  if (superHook != null && !context.inherited) {
    result = superHook!.afterDecode(result) as T;
  }

  return result;
}