addTemplate method
Adds a template of scope (personal of ownerId, or channel of channelId) and
returns it.
Implementation
JsonMap addTemplate({
required String scope,
required String name,
required String contentMd,
String? ownerId,
String? channelId,
}) {
final id = nextId();
final template = <String, Object?>{
'id': id,
'scope': scope,
'channel_id': ?channelId,
'name': name,
'content_md': contentMd,
'version': 1,
};
templates[id] = template;
if (ownerId != null) templateOwners[id] = ownerId;
return template;
}