QuickRTCState class
Immutable state for QuickRTC
This class represents the complete state of a QuickRTC session, including connection status, local streams, and remote participants.
Example:
QuickRTCBuilder(
buildWhen: (prev, curr) => prev.status != curr.status,
builder: (context, state) {
if (state.isConnected) {
return ConferenceView(participants: state.participantList);
}
return JoinButton();
},
)
Constructors
-
QuickRTCState({int version = 0, ConnectionStatus status = ConnectionStatus.disconnected, String? conferenceId, String? participantId, String? participantName, List<
LocalStream> localStreams = const [], Map<String, RemoteParticipant> participants = const {}, String? error}) -
const
Properties
-
allRemoteStreams
→ List<
RemoteStream> -
All remote streams from all participants
no setter
- conferenceId → String?
-
Conference/room ID (null if not connected)
final
- error → String?
-
Current error message (null if no error)
final
- hasError → bool
-
Whether there is an error
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasLocalAudio → bool
-
Whether local audio is being produced
no setter
-
Whether screen is being shared
no setter
- hasLocalVideo → bool
-
Whether local video is being produced
no setter
- isConnected → bool
-
Whether currently connected to a conference
no setter
- isConnecting → bool
-
Whether currently connecting to a conference
no setter
- isDisconnected → bool
-
Whether disconnected from any conference
no setter
- isLocalAudioActive → bool
-
Whether local audio is active (has audio AND not paused)
no setter
- isLocalAudioPaused → bool
-
Whether local audio is paused
no setter
-
Whether local screenshare is active (has screenshare AND not paused)
no setter
-
Whether local screenshare is paused
no setter
- isLocalVideoActive → bool
-
Whether local video is active (has video AND not paused)
no setter
- isLocalVideoPaused → bool
-
Whether local video is paused
no setter
- localAudioStream → LocalStream?
-
Local audio stream (null if not producing audio)
no setter
-
Local screenshare stream (null if not sharing screen)
no setter
-
localStreams
→ List<
LocalStream> -
List of local streams (audio, video, screenshare)
final
- localVideoStream → LocalStream?
-
Local video stream (null if not producing video)
no setter
- participantCount → int
-
Total number of remote participants
no setter
- participantId → String?
-
Local participant ID (null if not connected)
final
-
participantList
→ List<
RemoteParticipant> -
List of all remote participants
no setter
- participantName → String?
-
Local participant display name
final
-
participants
→ Map<
String, RemoteParticipant> -
Map of remote participants by their ID
final
-
props
→ List<
Object?> -
The list of properties that will be used to determine whether
two instances are equal.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- status → ConnectionStatus
-
Current connection status
final
- stringify → bool?
-
If set to
true, thetoStringmethod will be overridden to output this instance'sprops.no setterinherited - version → int
-
Version counter - increments on every state change to ensure inequality
This solves issues where nested objects (like MediaStream) don't properly
compare, causing Equatable to incorrectly report states as equal.
final
Methods
-
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}) → QuickRTCState - Create a copy of this state with the given fields replaced
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String - A string representation of this object.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited