encodeTo method

  1. @override
void encodeTo(
  1. Map<String, dynamic> value,
  2. Output output
)
override

Encodes Composite of values.

Implementation

@override
void encodeTo(Map<String, dynamic> value, Output output) {
  if (mappedCodec.isEmpty) {
    return;
  }

  for (final entry in mappedCodec.entries) {
    if (mappedCodec.containsKey(entry.key) == false) {
      throw CompositeException(
          'Codec not found for key: ${entry.key}, in mappedCodec: $mappedCodec');
    }

    final codec = entry.value;
    codec.encodeTo(value[entry.key], output);
  }
}