FakeBroadcastManager class

A fake BroadcastManager for testing.

Routes all broadcasting operations through an in-memory fake driver instead of a real WebSocket connection. Provides assertion helpers for verifying expected broadcasting activity.

final fake = Echo.fake();

Echo.channel('orders');

fake.assertSubscribed('orders');
fake.assertConnected();
Inheritance

Constructors

FakeBroadcastManager()

Properties

driver FakeBroadcastDriver
The underlying fake driver, exposed for direct inspection in tests.
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

assertConnected() → void
Assert that the fake driver is currently connected.
assertDisconnected() → void
Assert that the fake driver is currently disconnected.
assertInterceptorAdded() → void
Assert that at least one interceptor has been added to the driver.
assertListening(String channel, String event) → void
Assert that a handler for event is registered on channel.
assertNotListening(String channel, String event) → void
Assert that NO handler for event is registered on channel.
assertNotSubscribed(String channel) → void
Assert that channel is NOT in the subscribed channels list.
assertSubscribed(String channel) → void
Assert that channel is currently in the subscribed channels list.
connection([String? name]) BroadcastDriver
Get the broadcast driver for the given name, or the default connection.
override
dispatch(String channel, String event, Map<String, dynamic> data) → void
Deliver data to the handler registered for event on channel, exactly as the driver would on an incoming frame.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reset() → void
Clear all recorded state on the fake driver.
toString() String
A string representation of this object.
inherited

Operators

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