requestSubscribeChannel method

void requestSubscribeChannel(
  1. List<String> channelIds
)
override

Android Only 请求订阅小米消息渠道。结果通过 addEventHandler 的 onCommandResult 回调。

Implementation

void requestSubscribeChannel(List<String> channelIds) {
  if (!Platform.isAndroid) {
    return;
  }
  if (channelIds.isEmpty || channelIds.length > 3) {
    throw ArgumentError.value(
        channelIds, 'channelIds', 'must contain between 1 and 3 items');
  }
  if (channelIds.any((channelId) => channelId.trim().isEmpty)) {
    throw ArgumentError.value(
        channelIds, 'channelIds', 'items must not be empty');
  }
  _channel.invokeMethod(
      'requestSubscribeChannel', {'channelIds': channelIds});
}