link top-level property
Codec to convert LinkAttribute to/from JSON (see DocumentJsonCodec).
Implementation
final link = TextAttributeCodec<LinkAttribute>.stateful(
typeStr: 'link',
encode: (attr) => attr.uri,
decode: (uri) {
if (uri is! String) {
throw Exception('Expected string as data for link attribute.');
}
return LinkAttribute(uri);
},
);