initHandler method

  1. @override
void initHandler()
override

Implementation

@override
void initHandler() {
  ClientChannel.setMethodCallHandler((MethodCall call) async {
    Map<String, dynamic>? argMap = call.arguments;
    EMLog.d("${call.method}: arguments: $argMap");
    if (call.method == ChatMethodKeys.onConnected) {
      return _onConnected();
    } else if (call.method == ChatMethodKeys.onDisconnected) {
      return _onDisconnected();
    } else if (call.method == ChatMethodKeys.onUserDidLoginFromOtherDevice) {
      LoginExtensionInfo info = LoginExtensionInfo.fromJson(argMap!);
      _onUserDidLoginFromOtherDevice(info);
    } else if (call.method == ChatMethodKeys.onUserDidRemoveFromServer) {
      _onUserDidRemoveFromServer();
    } else if (call.method == ChatMethodKeys.onUserDidForbidByServer) {
      _onUserDidForbidByServer();
    } else if (call.method == ChatMethodKeys.onUserDidChangePassword) {
      _onUserDidChangePassword();
    } else if (call.method == ChatMethodKeys.onUserDidLoginTooManyDevice) {
      _onUserDidLoginTooManyDevice();
    } else if (call.method == ChatMethodKeys.onUserKickedByOtherDevice) {
      _onUserKickedByOtherDevice();
    } else if (call.method == ChatMethodKeys.onUserAuthenticationFailed) {
      _onUserAuthenticationFailed();
    } else if (call.method == ChatMethodKeys.onMultiDeviceGroupEvent) {
      _onMultiDeviceGroupEvent(argMap!);
    } else if (call.method == ChatMethodKeys.onMultiDeviceContactEvent) {
      _onMultiDeviceContactEvent(argMap!);
    } else if (call.method == ChatMethodKeys.onMultiDeviceThreadEvent) {
      _onMultiDeviceThreadEvent(argMap!);
    } else if (call.method ==
        ChatMethodKeys.onMultiDeviceRemoveMessagesEvent) {
      _onMultiDeviceRoamMessagesRemovedEvent(argMap!);
    } else if (call.method ==
        ChatMethodKeys.onMultiDevicesConversationEvent) {
      _onMultiDevicesConversationEvent(argMap!);
    } else if (call.method == ChatMethodKeys.onSendDataToFlutter) {
      _onReceiveCustomData(argMap!);
    } else if (call.method == ChatMethodKeys.onTokenWillExpire) {
      _onTokenWillExpire(argMap);
    } else if (call.method == ChatMethodKeys.onTokenDidExpire) {
      _onTokenDidExpire(argMap);
    } else if (call.method == ChatMethodKeys.onAppActiveNumberReachLimit) {
      _onAppActiveNumberReachLimit(argMap);
    } else if (call.method == ChatMethodKeys.onOfflineMessageSyncStart) {
      _onOfflineMessageSyncStart(argMap);
    } else if (call.method == ChatMethodKeys.onOfflineMessageSyncFinish) {
      _onOfflineMessageSyncFinish(argMap);
    }
  });
}