Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ export 'package:launchdarkly_common_client/launchdarkly_common_client.dart'
StreamingInitializer,
PollingSynchronizer,
StreamingSynchronizer,
Fdv1FallbackConfig;
Fdv1FallbackConfig,
SSEClient,
SseClientBuilder;

export 'src/ld_client.dart' show LDClient;
export 'src/config/ld_config.dart' show LDConfig, ApplicationEvents;
Expand Down
13 changes: 12 additions & 1 deletion packages/flutter_client_sdk/lib/src/config/ld_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,16 @@ final class LDConfig extends LDCommonConfig {
/// [dataSystem] opts the SDK into the FDv2 data acquisition protocol.
/// This feature is not stable, and not subject to any backwards
/// compatibility guarantees or semantic versioning. It is in early access.
///
/// [eventSource] builds the SSE client that the SDK uses for streaming.
/// When it is null, the SDK uses the default client for the platform. On
/// web, that is the browser `EventSource`. It cannot send a request body
/// or report an HTTP error, so [DataSourceConfig.useReport] falls back to
/// GET and [DataSystemConfig.usePost] falls back to polling. Pass
/// `SSEClient.http` to stream with `fetch()` instead. Both methods then
/// work on web. Pass only a client that can send a request body. Most
/// applications do not need this option. A web build that leaves it null
/// does not include the HTTP-based client.
LDConfig(super.sdkCredential, super.autoEnvAttributes,
{super.applicationInfo,
super.httpProperties,
Expand All @@ -108,7 +118,8 @@ final class LDConfig extends LDCommonConfig {
ApplicationEvents? applicationEvents,
super.hooks,
List<Plugin>? plugins,
super.dataSystem})
super.dataSystem,
super.eventSource})
Comment thread
devin-ai-integration[bot] marked this conversation as resolved.
Resolved
: applicationEvents = applicationEvents ?? ApplicationEvents(),
plugins =
plugins != null ? UnmodifiableListView(List.from(plugins)) : null;
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter_client_sdk/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dependencies:
sdk: flutter
package_info_plus: ">=4.2.0 <11.0.0"
device_info_plus: ">=9.1.1 <14.0.0"
launchdarkly_common_client: 1.15.1
launchdarkly_common_client: 1.16.0
shared_preferences: ^2.2.2
connectivity_plus: ">=5.0.2 <8.0.0"
web: ^1.1.1
Expand Down
17 changes: 17 additions & 0 deletions packages/flutter_client_sdk/test/ld_config_streaming_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:launchdarkly_flutter_client_sdk/launchdarkly_flutter_client_sdk.dart';

void main() {
test('eventSource is null by default', () {
final config = LDConfig('credential', AutoEnvAttributes.disabled);

expect(config.eventSource, isNull);
});

test('eventSource is stored in the configuration', () {
final config = LDConfig('credential', AutoEnvAttributes.disabled,
eventSource: SSEClient.http);

expect(config.eventSource, same(SSEClient.http));
});
}
Loading