setValue method

Future<void> setValue(
  1. String key,
  2. String? value
)

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 null to 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.

Parameters

  • key - The unique key to store the data under.
  • value - The string value to be stored. Pass null to 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);