onInit method
Called immediately after the widget is allocated in memory. You might use this to initialize something for the controller.
Implementation
@override
Future<void> onInit() async {
if (!Get.isRegistered<RoomStore>() || !RoomStore.to.isEnteredRoom) {
if (conferenceId == null || isCreateConference == null) {
_showNotEnteredRoomDialog();
return;
}
await _enterConference(
conferenceId!, isCreateConference!, conferenceParams);
} else if (conferenceId != null &&
conferenceId != RoomStore.to.roomInfo.roomId) {
_showDifferentRoomIdDialog();
}
isEnteredRoom.value = RoomStore.to.isEnteredRoom;
observer = TUIRoomObserver(
onRequestReceived: (request) {
switch (request.requestAction) {
case TUIRequestAction.requestToOpenRemoteCamera:
case TUIRequestAction.requestToOpenRemoteMicrophone:
case TUIRequestAction.requestRemoteUserOnSeat:
showRequestDialog(request);
break;
default:
break;
}
},
onRequestCancelled: (requestId, userId) {
if (isCameraInviteDialogShow) {
Get.back();
isCameraInviteDialogShow = false;
}
if (isMicrophoneInviteDialogShow) {
Get.back();
isMicrophoneInviteDialogShow = false;
}
},
onRoomDismissed: (roomId, reason) {
conferenceObserver?.onConferenceFinished
?.call(RoomStore.to.roomInfo.roomId);
RoomStore.to.clearStore();
showExitRoomDialog('roomDestroyed'.roomTr);
},
onKickedOutOfRoom: (roomId, reason, message) {
conferenceObserver?.onConferenceExited
?.call(RoomStore.to.roomInfo.roomId);
RoomStore.to.clearStore();
showExitRoomDialog('kickedOutOfRoom'.roomTr);
},
);
RoomEngineManager().addObserver(observer!);
super.onInit();
}