setValue method
The setValue() method is used to store or update data in the RealtimeStore. If a key already exists, it will be overwritten with the new value. Passing null as the value deletes the key.
Key Notes:
- Supports String values only.
- Each key can store up to 1 KB of data.
- A maximum of 100 keys are allowed per session.
- Deletion is performed by setting the value to
null. - Throws a VideoSDKError if:
- The key is empty, or the value is empty or only whitespace (use
nullto delete):3073. - The value is larger than 1 KB:
3072. - The room has not been joined yet:
3035. - The request fails.
- The session exceeds the 100-key limit.
- The key is empty, or the value is empty or only whitespace (use
Parameters
key- The unique key to store the data under.value- The string value to be stored. Passnullto delete the key.
Example
String key = "BLOCK_CHAT";
String value = "true";
try {
await room.realtimeStore.setValue(key, value);
} catch(e) {
print("Error:$e");
}
Implementation
Future<void> setValue(String key, String? value) => _setValue(key, value);