withDocs method
Expression
withDocs(
- Reference meta,
- List<String> docs
)
Implementation
Expression withDocs(Reference meta, List<String> docs) {
if (docs.isEmpty) return meta;
return meta.property('copyWith').call(
[],
{
'documentation': literalList([
meta.property('documentation').spread,
for (final (i, doc) in docs.indexed)
InvokeExpression.newOf(
refer('DocumentEntry'),
[],
{
'name': CodeExpression(
Code("'Docs${docs.length > 1 ? ' $i' : ''}'"),
),
'content': literalString(doc.escaped),
},
),
]),
},
);
}