encodeTo method
Convert self to a slice and append it to the destination.
Implementation
@override
void encodeTo(Map<String, dynamic> value, Output output) {
for (int i = 0; i < extensions.length; i++) {
final key = extensions[i].identifier;
final val = value[key];
if (val == null) {
if (codecs[i] is! NullCodec && codecs[i].isSizeZero() == false) {
throw MetadataException('Missing signed extension value for $key.');
}
// We can continue to next because this codec doesn't encode anything.
// And even calling encode would not have any impact on the size
continue;
}
try {
codecs[i].encodeTo(val, output);
} catch (_) {
throw Exception('exception here at key:$key, value:$value, codec=${codecs[i]}');
}
}
}