leave method

Future<bool> leave(
  1. BuildContext context, {
  2. bool showConfirmation = false,
})

This function is used to end the Live Streaming.

You can pass the context context for any necessary pop-ups or page transitions. By using the showConfirmation parameter, you can control whether to display a confirmation dialog to confirm ending the Live Streaming.

This function behaves the same as the close button in the calling interface's top right corner, and it is also affected by the ZegoUIKitPrebuiltLiveStreamingEvents.onLeaveConfirmation, ZegoUIKitPrebuiltLiveStreamingEvents.onEnded settings in the config.

Implementation

Future<bool> leave(
  BuildContext context, {
  bool showConfirmation = false,
}) async {
  final result =
      await room._leave(context, showConfirmation: showConfirmation);

  await ZegoUIKitPrebuiltLiveStreamingController().pip.cancelBackground();

  private.uninitByPrebuilt();
  pk.private.uninitByPrebuilt();
  room.private.uninitByPrebuilt();
  user.private.uninitByPrebuilt();
  message.private.uninitByPrebuilt();
  coHost.private.uninitByPrebuilt();
  audioVideo.private.uninitByPrebuilt();
  minimize.private.uninitByPrebuilt();
  pip.private.uninitByPrebuilt();
  screenSharing.private.uninitByPrebuilt();
  swiping.private.uninitByPrebuilt();

  return result;
}