updateMetaCounters method Null safety

Future<Map<String, int>> updateMetaCounters(
  1. Map<String, int> metaCounters
)

Updates meta counters on this channel with metaCounters.

It returns Map<String, int> that newly updated. Once it completes successfully, channel event ChannelEventHandler.onMetaCountersUpdated will be invoked. Updated given key will be replaced with given value.

before

{'key1' : 2}

updateMetaCounters({'key1': 5})

after

{'key1': 5}

Implementation

Future<Map<String, int>> updateMetaCounters(
    Map<String, int> metaCounters) async {
  if (metaCounters.isEmpty) {
    throw InvalidParameterError();
  }

  return _sdk.api.send(
    ChannelMetaCounterUpdateRequest(
      channelType: channelType,
      channelUrl: channelUrl,
      metaCounter: metaCounters,
      mode: MetaCounterMode.set,
    ),
  );
}