feat: Add experimental support for data-saving mode (FDv2).#314
Open
kinyoklion wants to merge 2 commits into
Open
feat: Add experimental support for data-saving mode (FDv2).#314kinyoklion wants to merge 2 commits into
kinyoklion wants to merge 2 commits into
Conversation
This was referenced Jun 25, 2026
kinyoklion
commented
Jun 25, 2026
| PersistenceConfig, | ||
| ApplicationInfo, | ||
| ConnectionMode, | ||
| FDv2ConnectionMode, |
Member
Author
There was a problem hiding this comment.
We technically did export these, but didn't use them. So I am not going to consider it breaking.
kinyoklion
commented
Jun 25, 2026
| /// 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]) { |
Member
Author
There was a problem hiding this comment.
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.
0a9b5dd to
dd322f6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
LDConfiggains adataSystemoption (passed through toLDCommonConfig). 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;nullclears it and resumes automatic resolution). Early access.DataSystemConfig,ConnectionModeId,ModeDefinition,EndpointConfig,InitializerEntry/SynchronizerEntry,CacheInitializer/PollingInitializer/StreamingInitializer/PollingSynchronizer/StreamingSynchronizer,Fdv1FallbackConfig) and removes the internalFDv2*connection-mode types from the public surface (they’re used internally bysetConnectionMode, not part of the API).Validation
flutter analyzeclean; all 47 flutter package tests pass against current main.Release note
The
launchdarkly_common_clientpin is still1.13.0(the last released version, which predates FDv2). CI resolves it via the melos path override, so the workspace builds against the FDv2common_clienton main. Before this ships,common_clientmust release with the FDv2 work and this pin must be bumped (perRELEASING.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.dataSystemopts into the FDv2 protocol, and related config types (DataSystemConfig,ConnectionModeId, pipeline types, etc.) are exported while internalFDv2*connection-mode types are removed from the public barrel.DataSystemConfig.initialConnectionModeis added as a sticky startup override (same semantics as callingsetConnectionModeright after create).LDClient.setConnectionMode([ConnectionModeId?])exposes that override at runtime; clearing withnullresumes automatic resolution.ConnectionManagerConfig.initialModeOverrideseeds the connection manager the same way on first reconcile.When FDv2 is enabled,
DataSourceConfig.initialConnectionModeis ignored in favor of data-system settings: common client and Flutter wiring default the foreground slot to streaming and applyinitialConnectionModeonly 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.