decodeValue<V> method

V decodeValue<V>(
  1. Object? value, [
  2. DecodingOptions? options,
  3. MapperContainer? container
])

Implementation

V decodeValue<V>(Object? value,
    [DecodingOptions? options, MapperContainer? container]) {
  if (value == null || (options?.type == null && value is V)) {
    return value as V;
  }
  var type = options?.type ?? V;
  try {
    return decoder(
      value,
      DecodingContext(
        container: container,
        args: () => type.args,
        options: options,
      ),
    ) as V;
  } catch (e, stacktrace) {
    Error.throwWithStackTrace(
      MapperException.chain(MapperMethod.decode, '($type)', e),
      stacktrace,
    );
  }
}