MockWebSocketAdapter class
Mock WebSocket adapter for testing purposes
- Implemented types
Constructors
- MockWebSocketAdapter.new(WebSocketConfig _config)
Properties
- config → WebSocketConfig
-
Configuration used for this adapter
no setteroverride
- currentState → WebSocketState
-
Current connection state
no setteroverride
- errorStream → Stream
-
Stream of connection errors
no setteroverride
- hashCode → int
-
The hash code for this object.
no setterinherited
- isClosed → bool
-
Checks if the connection is closed
no setteroverride
- isConnected → bool
-
Checks if the connection is currently active
no setteroverride
- isConnecting → bool
-
Checks if the connection is in a connecting state
no setteroverride
-
messageStream
→ Stream<
WebSocketMessage> -
Stream of incoming messages
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
sentMessages
→ List<
WebSocketMessage> -
no setter
-
stateStream
→ Stream<
WebSocketState> -
Stream of connection state changes
no setteroverride
Methods
-
clearSentMessages(
) → void -
connect(
) → Future< void> -
Establishes a WebSocket connection
override
-
disconnect(
[int? code, String? reason]) → Future< void> -
Closes the WebSocket connection
override
-
dispose(
) → Future< void> -
Disposes of the adapter and cleans up resources
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
send(
dynamic data) → Future< void> -
Sends raw data through the WebSocket
override
-
sendMessage(
WebSocketMessage message) → Future< void> -
Sends a message through the WebSocket
override
-
setAutoRespondToPing(
bool autoRespond) → void -
setConnectionDelay(
Duration delay) → void -
setShouldFailConnection(
bool shouldFail) → void -
setShouldFailSending(
bool shouldFail) → void -
setSimulateUnstableConnection(
bool simulate) → void -
simulateDisconnection(
) → void -
simulateError(
dynamic error) → void -
simulateJsonMessage(
Map< String, dynamic> json) → void -
simulateMessage(
WebSocketMessage message) → void -
simulateNetworkInstability(
) → void -
simulatePongMessage(
[String? customPong]) → void -
simulateTextMessage(
String text) → void -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited