QuickRTCConsumer class

A comprehensive wrapper widget that combines Provider, Listener, and Builder.

QuickRTCConsumer is the recommended way to wrap your entire conference UI. It provides:

  • Provider: Makes controller accessible to all descendants via context
  • Listener: Handles side effects (errors, navigation, snackbars)
  • Builder: Rebuilds UI reactively when state changes

The builder receives BOTH state AND controller, giving you full access to read state and invoke actions.

Basic Usage

QuickRTCConsumer(
  controller: _controller,
  builder: (context, state, controller) {
    return VideoGrid(
      participants: state.participantList,
      onLeave: () => controller.leaveMeeting(),
    );
  },
)

With Error Handling

QuickRTCConsumer(
  controller: _controller,
  listenWhen: (prev, curr) => prev.error != curr.error,
  listener: (context, controller) {
    if (controller.state.hasError) {
      ScaffoldMessenger.of(context).showSnackBar(
        SnackBar(content: Text(controller.state.error!)),
      );
    }
  },
  buildWhen: (prev, curr) => prev.participantCount != curr.participantCount,
  builder: (context, state, controller) {
    return ConferenceView(state: state);
  },
  onError: (context, error) => ErrorScreen(message: error),
)

Accessing Controller in Descendants

Inside the builder's widget tree, you can access the controller:

// For actions (doesn't subscribe to changes)
final controller = QuickRTCProvider.read(context);
await controller.leaveMeeting();

// For state (subscribes to changes - use in build methods)
final state = QuickRTCProvider.stateOf(context);
Inheritance

Constructors

QuickRTCConsumer({Key? key, required QuickRTCController controller, QuickRTCListenWhen? listenWhen, QuickRTCConsumerWidgetListener? listener, QuickRTCBuildWhen? buildWhen, required QuickRTCConsumerWidgetBuilder builder, QuickRTCErrorBuilder? onError})
Creates a QuickRTCConsumer.
const

Properties

builder → QuickRTCConsumerWidgetBuilder
The builder function that returns the widget tree.
final
buildWhen → QuickRTCBuildWhen?
Optional condition for when to rebuild the widget.
final
controller → QuickRTCController
The QuickRTCController instance to provide and observe
final
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
listener → QuickRTCConsumerWidgetListener?
Callback for side effects (errors, navigation, snackbars, etc.)
final
listenWhen → QuickRTCBuildWhen?
Optional condition for when to call the listener.
final
onError → QuickRTCErrorBuilder?
Optional error builder.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<QuickRTCConsumer>
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