setItem method

CloudStorage setItem(
  1. String key,
  2. String value, [
  3. void callback(
    1. String? error, [
    2. bool? isStored
    ])?
])

A method that stores a value in the cloud storage using the specified key. You can store up to 1024 keys in the cloud storage key should contain 1-128 characters, only A-Z, a-z, 0-9, _ and - are allowed value should contain 0-4096 characters. If an optional eventHandler parameter was passed, the callback function will be called. In case of an error, the first argument will contain the error. In case of success, the first argument will be null and the second argument will be a boolean indicating whether the value was stored.

Implementation

CloudStorage setItem(String key, String value, [void Function(String? error, [bool? isStored])? callback]) {
  Telegram.WebApp.CloudStorage.setItem(key, value, callback?.toJS);

  return this;
}