Skip to content

feat: Add experimental support for data-saving mode (FDv2).#314

Open
kinyoklion wants to merge 2 commits into
rlamb/sdk-2187/fdv2-connection-modefrom
rlamb/sdk-2188/expose-fdv2-data-system
Open

feat: Add experimental support for data-saving mode (FDv2).#314
kinyoklion wants to merge 2 commits into
rlamb/sdk-2187/fdv2-connection-modefrom
rlamb/sdk-2188/expose-fdv2-data-system

Conversation

@kinyoklion

@kinyoklion kinyoklion commented Jun 25, 2026

Copy link
Copy Markdown
Member

The final wiring PR for FDv2 in the Flutter SDK: surfaces the data system on the public API so applications can use it. The data system itself lives in common_client (already on main via #310/#311/#312); this PR is the Flutter exposure.

Changes

  • LDConfig gains a dataSystem option (passed through to LDCommonConfig). Setting it opts the SDK into FDv2. Documented as early access / not semver-stable.
  • LDClient.setConnectionMode([ConnectionMode?]) — applies a manual connection-mode override (sticks and suppresses automatic state-detection transitions; null clears it and resumes automatic resolution). Early access.
  • Public exports — adds the data-system configuration types (DataSystemConfig, ConnectionModeId, ModeDefinition, EndpointConfig, InitializerEntry/SynchronizerEntry, CacheInitializer/PollingInitializer/StreamingInitializer/PollingSynchronizer/StreamingSynchronizer, Fdv1FallbackConfig) and removes the internal FDv2* connection-mode types from the public surface (they’re used internally by setConnectionMode, not part of the API).

Validation

  • flutter analyze clean; all 47 flutter package tests pass against current main.
  • End-to-end behavior (incl. FDv1 fallback) is exercised by the v3 contract tests — added in the stacked follow-up.

Release note

The launchdarkly_common_client pin is still 1.13.0 (the last released version, which predates FDv2). CI resolves it via the melos path override, so the workspace builds against the FDv2 common_client on main. Before this ships, common_client must release with the FDv2 work and this pin must be bumped (per RELEASING.md: common → common_client → flutter, in dependency order).

Two drafts will be stacked on this PR: the v3 contract tests, and the FDv2 example app.


Note

Medium Risk
Changes flag data acquisition and connection-mode resolution when FDv2 is enabled; behavior is EAP-gated but affects networking and lifecycle-driven mode switching.

Overview
Surfaces FDv2 / data-saving mode on the Flutter public API: LDConfig.dataSystem opts into the FDv2 protocol, and related config types (DataSystemConfig, ConnectionModeId, pipeline types, etc.) are exported while internal FDv2* connection-mode types are removed from the public barrel.

DataSystemConfig.initialConnectionMode is added as a sticky startup override (same semantics as calling setConnectionMode right after create). LDClient.setConnectionMode([ConnectionModeId?]) exposes that override at runtime; clearing with null resumes automatic resolution. ConnectionManagerConfig.initialModeOverride seeds the connection manager the same way on first reconcile.

When FDv2 is enabled, DataSourceConfig.initialConnectionMode is ignored in favor of data-system settings: common client and Flutter wiring default the foreground slot to streaming and apply initialConnectionMode only via the connection manager override path.

Reviewed by Cursor Bugbot for commit dd322f6. Bugbot is set up for automated code reviews on this repo. Configure here.

@kinyoklion kinyoklion changed the title feat: expose the FDv2 data system through the Flutter SDK feat: Add experimental support for data-saving mode (FDv2). Jun 25, 2026
PersistenceConfig,
ApplicationInfo,
ConnectionMode,
FDv2ConnectionMode,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We technically did export these, but didn't use them. So I am not going to consider it breaking.

@kinyoklion kinyoklion marked this pull request as ready for review June 25, 2026 21:50
@kinyoklion kinyoklion requested a review from a team as a code owner June 25, 2026 21:50
/// compatibility guarantees or semantic versioning. It is in early
/// access. If you want access to this feature please join the EAP.
/// https://launchdarkly.com/docs/sdk/features/data-saving-mode
void setConnectionMode([ConnectionMode? mode]) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't using the correct connection modes.

Surface the FDv2 data acquisition protocol on the public Flutter API:
- LDConfig gains a dataSystem option (opts into FDv2; early access).
- LDClient.setConnectionMode([ConnectionMode?]) applies a manual
  connection-mode override (sticks and suppresses automatic transitions;
  null clears it).
- Export the data-system configuration types (DataSystemConfig,
  ConnectionModeId, ModeDefinition, EndpointConfig, the initializer /
  synchronizer entries, and Fdv1FallbackConfig) and drop the internal
  FDv2* connection-mode types from the public surface.

The data system itself is built in common_client; this is the Flutter
wiring that lets applications configure and use it.
setConnectionMode now accepts a ConnectionModeId so it can reach all FDv2
built-in modes (including background) rather than only the FDv1 streaming,
polling, and offline modes.

A configured DataSystemConfig.initialConnectionMode is applied as the
connection managers initial sticky override, equivalent to calling
setConnectionMode immediately after construction. Under the FDv2 data
system the automatic-resolution foreground slot defaults to streaming and
no longer reads the FDv1 DataSourceConfig.initialConnectionMode.
@kinyoklion kinyoklion force-pushed the rlamb/sdk-2188/expose-fdv2-data-system branch from 0a9b5dd to dd322f6 Compare June 25, 2026 22:59
@kinyoklion kinyoklion changed the base branch from main to rlamb/sdk-2187/fdv2-connection-mode June 25, 2026 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant