copyWith method Null safety

AgoraEventHandlers copyWith(
  1. {dynamic userJoined(
    1. int uid,
    2. int elapsed
    )?,
  2. dynamic joinChannelSuccess(
    1. String channel,
    2. int uid,
    3. int elapsed
    )?,
  3. dynamic onError(
    1. ErrorCode errorCode
    )?,
  4. dynamic leaveChannel(
    1. RtcStats stats
    )?,
  5. dynamic userOffline(
    1. int uid,
    2. UserOfflineReason reason
    )?,
  6. dynamic tokenPrivilegeWillExpire(
    1. String token
    )?,
  7. dynamic remoteVideoStateChanged(
    1. int uid,
    2. VideoRemoteState state,
    3. VideoRemoteStateReason reason,
    4. int elapsed
    )?,
  8. dynamic remoteAudioStateChanged(
    1. int uid,
    2. AudioRemoteState state,
    3. AudioRemoteStateReason reason,
    4. int elapsed
    )?,
  9. dynamic localAudioStateChanged(
    1. AudioLocalState state,
    2. AudioLocalError error
    )?,
  10. dynamic localVideoStateChanged(
    1. LocalVideoStreamState localVideoState,
    2. LocalVideoStreamError error
    )?,
  11. dynamic activeSpeaker(
    1. int uid
    )?}
)

Implementation

AgoraEventHandlers copyWith({
  Function(int uid, int elapsed)? userJoined,
  Function(String channel, int uid, int elapsed)? joinChannelSuccess,
  Function(ErrorCode errorCode)? onError,
  Function(RtcStats stats)? leaveChannel,
  Function(int uid, UserOfflineReason reason)? userOffline,
  Function(String token)? tokenPrivilegeWillExpire,
  Function(int uid, VideoRemoteState state, VideoRemoteStateReason reason,
          int elapsed)?
      remoteVideoStateChanged,
  Function(int uid, AudioRemoteState state, AudioRemoteStateReason reason,
          int elapsed)?
      remoteAudioStateChanged,
  Function(AudioLocalState state, AudioLocalError error)?
      localAudioStateChanged,
  Function(
          LocalVideoStreamState localVideoState, LocalVideoStreamError error)?
      localVideoStateChanged,
  Function(int uid)? activeSpeaker,
}) {
  return AgoraEventHandlers(
    userJoined: userJoined ?? this.userJoined,
    joinChannelSuccess: joinChannelSuccess ?? this.joinChannelSuccess,
    onError: onError ?? this.onError,
    leaveChannel: leaveChannel ?? this.leaveChannel,
    userOffline: userOffline ?? this.userOffline,
    tokenPrivilegeWillExpire:
        tokenPrivilegeWillExpire ?? this.tokenPrivilegeWillExpire,
    remoteVideoStateChanged:
        remoteVideoStateChanged ?? this.remoteVideoStateChanged,
    remoteAudioStateChanged:
        remoteAudioStateChanged ?? this.remoteAudioStateChanged,
    localVideoStateChanged:
        localVideoStateChanged ?? this.localVideoStateChanged,
    localAudioStateChanged:
        localAudioStateChanged ?? this.localAudioStateChanged,
    activeSpeaker: activeSpeaker ?? this.activeSpeaker,
  );
}