TestSseClient class final
An SSE client to use for testing.
Changes may be made to this class without following semantic conventions.
- Implemented types
Constructors
-
TestSseClient.internal({required UnmodifiableMapView<
String, String> headers, required Duration connectTimeout, required Duration readTimeout, required String? body, required SseHttpMethod httpMethod, Stream<Event> ? sourceStream, Set<SSECapability> ? capabilities})
Properties
- body → String?
-
final
- connectTimeout → Duration
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
headers
→ UnmodifiableMapView<
String, String> -
final
- httpMethod → SseHttpMethod
-
final
- isClosed → bool
-
Whether close has been called on this client. Test-only --
production SSEClient implementations do not expose this state,
and tests asserting against it are inherently white-box. Use to
verify that code under test correctly tears the connection down.
no setter
- readTimeout → Duration
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
stream
→ Stream<
Event> -
Subscribe to this stream to receive events and sometimes errors.
subscribe triggers the connection, so expect network delay initially.
no setteroverride
Methods
-
close(
) → Future -
Closes the SSEClient and tears down connections and resources. Do not use the
SSEClient after close is called, behavior is undefined at that point.
override
-
emitError(
{Object? error}) → void - Emit an error event.
-
emitEvent(
Event event) → void - Emit an event on the stream. Has no effect if the client has been closed.
-
hasCapability(
SSECapability capability) → bool -
Whether this implementation supports the given
capability. Lets callers detect transport limitations at runtime — for example, the browser nativeEventSourcedoes not support SSECapability.requestHeaders, so callers that need to authenticate must fall back to a URL-based scheme.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
restart(
) → void -
Request that the SSEClient drops the current connection and then
establishes a new connection respecting delay/backoff as if this was
an error condition with the connection.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited