Skip to main content

encode method

*[<Null safety>](https://dart.dev/null-safety)*

Future<EncodedContent> encode (DecodedContent decoded)

override

Use the registered codecs to encode the content.

Implementation

@override
Future<xmtp.EncodedContent> encode(DecodedContent decoded) async {
var type = decoded.contentType;
var codec = _codecFor(type);
if (codec == null) {
throw StateError("unable to encode unsupported type ${_key(type)}");
}
return codec.encode(decoded.content);
}