deleteMetaData method

Future<void> deleteMetaData(
  1. String key
)

Deletes a meta data on this channel with key.

After this method completes successfully, channel event ChannelEventHandler.onMetaDataDeleted will be invoked.

Implementation

Future<void> deleteMetaData(String key) async {
  if (key.isEmpty) {
    throw InvalidParameterError();
  }

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

  final cached = _sdk.cache.find<CachedDataMap>(channelKey: channelUrl) ??
      CachedDataMap<String>(
        channelType: channelType,
        channelUrl: channelUrl,
        timestamp: ts,
      );
  cached.removeWithKey(key, ts);
  cached.saveToCache();
}