QuickRTCConference class

A batteries-included widget for joining and managing a WebRTC conference.

This widget handles the complete lifecycle of a conference:

  • Connects to the server
  • Joins the specified conference
  • Manages the controller lifecycle
  • Automatically renders remote audio (via QuickRTCAudioRenderers)
  • Provides error handling and retry functionality
  • Cleans up resources on dispose

Basic Usage

QuickRTCConference(
  serverUrl: 'https://your-server.com',
  conferenceId: 'room-123',
  participantName: 'Alice',
  builder: (context, state, controller) {
    return VideoGrid(
      participants: state.participantList,
      localVideoStream: state.localVideoStream,
    );
  },
)

With Custom Loading and Error Handling

QuickRTCConference(
  serverUrl: 'https://your-server.com',
  conferenceId: 'room-123',
  participantName: 'Alice',
  loadingBuilder: (context) => Center(
    child: CircularProgressIndicator(),
  ),
  errorBuilder: (context, error, retry) => Center(
    child: Column(
      mainAxisSize: MainAxisSize.min,
      children: [
        Text('Failed to connect: $error'),
        ElevatedButton(onPressed: retry, child: Text('Retry')),
      ],
    ),
  ),
  onJoined: (controller) {
    // Called when successfully joined
    controller.enableMedia();
  },
  onLeft: () {
    // Called when left the conference
    Navigator.of(context).pop();
  },
  builder: (context, state, controller) {
    return YourConferenceUI(state: state, controller: controller);
  },
)

Features

  • Auto-connect: Automatically connects to server and joins conference
  • Auto-audio: Includes QuickRTCAudioRenderers for remote audio playback
  • Lifecycle management: Creates and disposes controller automatically
  • Error handling: Built-in error states with retry capability
  • Provider included: Wraps children in QuickRTCProvider for easy access
Inheritance

Constructors

QuickRTCConference({Key? key, required String serverUrl, required String conferenceId, required String participantName, String? conferenceName, String? participantId, Map<String, dynamic>? participantInfo, required QuickRTCConferenceBuilder builder, QuickRTCLoadingBuilder? loadingBuilder, QuickRTCConferenceErrorBuilder? errorBuilder, void onJoined(QuickRTCController controller)?, VoidCallback? onLeft, void onError(Object error)?, bool debug = false, int maxParticipants = 0, Duration connectionTimeout = const Duration(seconds: 10), Duration socketTimeout = const Duration(seconds: 30), Duration operationTimeout = const Duration(seconds: 30), Map<String, String>? extraHeaders, Map<String, dynamic>? query, bool autoRenderAudio = true})
Creates a QuickRTCConference widget.
const

Properties

autoRenderAudio bool
Whether to automatically include QuickRTCAudioRenderers.
final
builder QuickRTCConferenceBuilder
Builder function that returns the main conference UI.
final
conferenceId String
The conference/room ID to join.
final
conferenceName String?
Optional conference display name.
final
connectionTimeout Duration
Timeout for initial connection.
final
debug bool
Enable debug logging in the controller.
final
errorBuilder QuickRTCConferenceErrorBuilder?
Optional builder for error states.
final
extraHeaders Map<String, String>?
Extra headers to include in the socket connection.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
loadingBuilder QuickRTCLoadingBuilder?
Optional builder for the loading state.
final
maxParticipants int
Maximum participants allowed (0 = unlimited).
final
onError → void Function(Object error)?
Called when an error occurs.
final
onJoined → void Function(QuickRTCController controller)?
Called when successfully joined the conference.
final
onLeft VoidCallback?
Called when the conference is left (either intentionally or due to error).
final
operationTimeout Duration
Timeout for producer/consumer operations.
final
participantId String?
Optional custom participant ID (generated if not provided).
final
participantInfo Map<String, dynamic>?
Optional additional participant information.
final
participantName String
The local participant's display name.
final
query Map<String, dynamic>?
Query parameters to include in the socket connection.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
serverUrl String
The WebRTC server URL to connect to.
final
socketTimeout Duration
Timeout for socket operations.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<QuickRTCConference>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited