joinPresentation static method

Future<Widget?>? joinPresentation(
  1. String callToken,
  2. PresentationSettings presentationSettings, {
  3. required dynamic onSuccess(
    1. Widget? callingWidget
    ),
  4. required dynamic onError(
    1. CometChatCallsException excep
    ),
})

Join Presentation mode.

  • callToken: The call token.
  • callSettings: The call settings.
  • onSuccess: A callback function that is called when the call session is successfully started.
  • onError: A callback function that is called when an error occurs while starting the call session.

Example: CometChatCalls.startSession( callToken: '<YOUR_CALL_TOKEN>', callSettings: <YOUR_CALL_SETTINGS>, onSuccess: (callingWidget) { // The call session was successfully started. }, onError: (error) { // An error occurred while starting the call session. }, );

Implementation

static Future<Widget?>? joinPresentation(String callToken, PresentationSettings presentationSettings, {
  required Function(Widget? callingWidget) onSuccess,
  required Function(CometChatCallsException excep) onError
}) async{
  try{
    final callingViewWidget = await CometchatcallsPluginPlatform.instance.joinPresentation(callToken, presentationSettings, onSuccess, onError);
    return callingViewWidget;
  }catch(e){
    CometChatCallsUtils.showLog("CometChatCall", "startSession: error: ${e.toString()}");
    onError(CometChatCallsException("Error", "Unable to start call session", e.toString()));
  }
  return null;
}