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 an error if:
- The key is missing or empty.
- 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. Passnullto delete the key.
Returns:
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);