decreaseMetaCounters method

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

Decreases 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. Given values will be added to given keys.

before

{'key1' : 10}

increaseMetaCounters({'key1': 9})

after

{'key1': 1}

Implementation

Future<Map<String, int>> decreaseMetaCounters(
    Map<String, int> metaCounters) async {
  if (metaCounters.isEmpty) {
    throw InvalidParameterError();
  }
  return _sdk.api.send(
    ChannelMetaCounterUpdateRequest(
      channelType: channelType,
      channelUrl: channelUrl,
      metaCounter: metaCounters,
      mode: MetaCounterMode.decrease,
    ),
  );
}