testClient static method

TestSseClient testClient(
  1. Uri uri,
  2. Set<String> eventTypes, {
  3. Map<String, String> headers = defaultHeaders,
  4. Duration connectTimeout = defaultConnectTimeout,
  5. Duration readTimeout = defaultReadTimeout,
  6. String? body,
  7. SseHttpMethod httpMethod = SseHttpMethod.get,
  8. Stream<Event>? sourceStream,
})

Get an SSE client for use in unit tests.

Most parameters are the same as those of the main SSEClient factory, but the test client supports an additional property which is the sourceStream. Events sent to the sourceStream will also be emitted by the event source if the event source has listeners. When a user unsubscribes from the event stream, then the test client will unsubscribe from the source stream.

This method is primarily for use the the LaunchDarkly SDK implementation. Changes may be made to this API without following semantic conventions.

Implementation

static TestSseClient testClient(
  Uri uri,
  Set<String> eventTypes, {
  Map<String, String> headers = defaultHeaders,
  Duration connectTimeout = defaultConnectTimeout,
  Duration readTimeout = defaultReadTimeout,
  String? body,
  SseHttpMethod httpMethod = SseHttpMethod.get,
  Stream<Event>? sourceStream,
}) {
  return TestSseClient.internal(
      headers: UnmodifiableMapView(headers),
      connectTimeout: connectTimeout,
      readTimeout: readTimeout,
      body: body,
      httpMethod: httpMethod,
      sourceStream: sourceStream);
}