decodeMapped method

  1. @override
MappedDecoder decodeMapped(
  1. String key, {
  2. int? id,
})
override

Decodes the data for the given key or id as a direct-access collection of key-value pairs of nested data.

Implementation

@override
MappedDecoder decodeMapped(String key, {int? id}) {
  try {
    return StandardMappedDecoder(_value[key] as Map<Object, dynamic>, _isHumanReadable, _customTypes);
  } on TypeError {
    throw CodableException.wrap(
      CodableException.unexpectedType(
          expected: 'Map<Object, dynamic>', actual: '${_value[key].runtimeType}', data: _value[key]),
      method: 'decode',
      hint: '["$key"]',
    );
  }
}