deleteMetaData method

Future<void> deleteMetaData(
  1. String key
)

Deletes a meta data.

Implementation

Future<void> deleteMetaData(String key) async {
  sbLog.i(StackTrace.current, 'key: $key');
  checkUnsupportedAction();

  if (key.isEmpty) {
    throw InvalidParameterException();
  }

  final ts = await chat.apiClient.send<int>(
    ChannelMetaDataDeleteRequest(
      chat,
      channelType: channelType,
      channelUrl: channelUrl,
      key: key,
    ),
  );

  final cached =
      chat.channelCache.find<MetaDataCache>(channelKey: channelUrl) ??
          MetaDataCache<String>(
            channelType: channelType,
            channelUrl: channelUrl,
            timestamp: ts,
          );
  cached.removeWithKey(key, ts);
  cached.saveToCache(chat);
}