copyWith method
QuickRTCState
copyWith({
- ConnectionStatus? status,
- String? conferenceId,
- String? participantId,
- String? participantName,
- List<
LocalStream> ? localStreams, - Map<
String, RemoteParticipant> ? participants, - String? error,
- bool clearError = false,
- bool clearConferenceId = false,
- bool clearParticipantId = false,
- bool clearParticipantName = false,
Create a copy of this state with the given fields replaced
Use clearError to explicitly clear the error field.
Use clearConferenceId, clearParticipantId, clearParticipantName
to explicitly clear those fields.
Note: The version is automatically incremented on every copyWith call to ensure state changes are always detected.
Implementation
QuickRTCState copyWith({
ConnectionStatus? status,
String? conferenceId,
String? participantId,
String? participantName,
List<LocalStream>? localStreams,
Map<String, RemoteParticipant>? participants,
String? error,
bool clearError = false,
bool clearConferenceId = false,
bool clearParticipantId = false,
bool clearParticipantName = false,
}) {
return QuickRTCState(
version: version + 1, // Always increment version
status: status ?? this.status,
conferenceId:
clearConferenceId ? null : (conferenceId ?? this.conferenceId),
participantId:
clearParticipantId ? null : (participantId ?? this.participantId),
participantName: clearParticipantName
? null
: (participantName ?? this.participantName),
localStreams: localStreams ?? this.localStreams,
participants: participants ?? this.participants,
error: clearError ? null : (error ?? this.error),
);
}