getMetaData method

Future<Map<String, String>> getMetaData(
  1. List<String> keys
)

Gets meta data.

Implementation

Future<Map<String, String>> getMetaData(List<String> keys) async {
  sbLog.i(StackTrace.current, 'keys: $keys');
  checkUnsupportedAction();

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

  final result = await chat.apiClient.send<MetaDataResponse>(
    ChannelMetaDataGetRequest(
      chat,
      channelType: channelType,
      channelUrl: channelUrl,
      keys: keys,
    ),
  );

  final cached =
      chat.channelCache.find<MetaDataCache>(channelKey: channelUrl) ??
          MetaDataCache<String>(
            channelType: channelType,
            channelUrl: channelUrl,
            timestamp: result.ts,
          );
  cached.addMap(result.metadata, result.ts);
  cached.saveToCache(chat);

  return result.metadata;
}