onUserLeave method

FutureOr<void> onUserLeave(
  1. dynamic uid,
  2. dynamic reason
)
override

@detail callback @brief This callback is triggered when a remote user is disconnected or turns invisible. @param uid ID of the user who leaves the room, or switches to invisible. @param reason Reason to leave the room:
- 0: The remote client calls leaveRoom{@link #RTSRoom#leaveRoom} to leave the room. - 1: The remote client is disconnected because of poor network connection or expired Token. - 2: The remote client calls setUserVisibility{@link #RTCRoom#setUserVisibility} to turn invisible. - 3: The remote user has been removed from the room by the administrator via a OpenAPI call.

Implementation

FutureOr<void> onUserLeave(dynamic uid, dynamic reason) async {
  if ($instance == null || $instance is! IRTSRoomEventHandler) {
    return;
  }
  return ($instance as IRTSRoomEventHandler)
      .onUserLeave
      ?.call(uid.toString(), int.tryParse(reason.toString()) ?? 0);
}