onEnded property

(void Function(ZegoLiveAudioRoomEndEvent event, VoidCallback defaultAction)?) onEnded
getter/setter pair

This callback method is called when live audio room ended

The default behavior of host is return to the previous page(only host) or hide the minimize page. If you override this callback, you must perform the page navigation yourself while it was in a normal state, or hide the minimize page if in minimize state. otherwise the user will remain on the live streaming page. the easy way is call defaultAction.call()

The ZegoLiveAudioRoomEndEvent.isFromMinimizing it means that the user left the chat room while it was in a minimized state. You can not return to the previous page while it was in a minimized state!!! On the other hand, if the value of the parameter is false, it means that the user left the chat room while it was in a normal state (i.e., not minimized).

Sample Code:

onEnded: (
    ZegoLiveAudioRoomEndEvent event,
    /// defaultAction to return to the previous page
    Future<bool> Function() defaultAction,
) {
  debugPrint('onEnded, do whatever you want');

  /// you can call this defaultAction to return to the previous page,
  return defaultAction.call();
}

Implementation

void Function(
  ZegoLiveAudioRoomEndEvent event,
  VoidCallback defaultAction,
)? onEnded;