getMetaData method

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

Retrieves meta data from this channel with keys.

Implementation

Future<Map<String, String>> getMetaData(List<String> keys) async {
  if (keys.isEmpty) {
    throw InvalidParameterError();
  }

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

  final cached = _sdk.cache.find<CachedDataMap>(channelKey: channelUrl) ??
      CachedDataMap<String>(
        channelType: channelType,
        channelUrl: channelUrl,
        timestamp: result.ts,
      );
  cached.addMap(result.metadata, result.ts);
  cached.saveToCache();

  return result.metadata;
}