Skip to main content

Manage tag data

This guide explains how to create and manage tag data using the Tag class. Each user can create up to 20 tags. Tag data syncs to the server.

Tag properties:

PropertyTypeDescription
tagIdString?Unique tag identifier (max 10 characters)
tagNameString?Tag name (max 15 characters, duplicates allowed)
createTimeint?Timestamp provided by the SDK's internal protocol stack
info

This guide only covers managing tag data. For setting tags on channels and querying channels by tag, see Set and use channel tags.

Create a tag

Dart
final tag = Tag();
await tag.createTag(
CreateTagParams(tagId: 'tag-001', tagName: 'Work'),
(createdTag, error) {
if (error == null) {
print('Tag created: ${createdTag?.tagId}');
}
},
);

Remove a tag

Dart
await tag.delete((error) {
if (error == null) {
print('Tag removed');
}
});

Update a tag

Dart
await tag.update(
UpdateTagParams(newName: 'Updated Name'),
(error) {
if (error == null) {
print('Tag updated');
}
},
);

Get all tags

Dart
await Tag.getTags((tags, error) {
if (error == null) {
print('All tags: $tags');
}
});