Commit c2f9216
authored
feat: Add experimental support for data-saving mode (FDv2). (#314)
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.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Changes how connection modes are chosen when FDv2 is enabled and adds
experimental runtime overrides over networking/lifecycle behavior;
impact is limited by early-access APIs and mostly additive wiring.
>
> **Overview**
> **Surfaces FDv2 (data-saving mode) on the Flutter public API** by
adding optional `dataSystem` on `LDConfig` (passed through to
`common_client`) and exporting the related configuration types
(`DataSystemConfig`, `ConnectionModeId`, initializer/synchronizer
entries, etc.). Internal `FDv2*` connection-mode types are **removed
from the public export list**; apps use `ConnectionModeId` instead.
>
> Adds **`LDClient.setConnectionMode([ConnectionModeId?])`** as an
early-access manual override that sticks until cleared with `null`,
wired through `ConnectionManager.setMode`.
**`ConnectionManagerConfig.initialModeOverride`** seeds that behavior at
construction (including from `dataSystem.initialConnectionMode`).
>
> When **`dataSystem` is configured**, foreground automatic resolution
defaults to **streaming** (not FDv1
`dataSourceConfig.initialConnectionMode`), and any configured initial
connection mode is applied as the sticky override. FDv1 apps without
`dataSystem` keep the previous data-source-driven initial mode.
>
> Tests cover initial override on startup, lifecycle suppression while
overridden, and resuming automatic resolution after clearing.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
f884852. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 15861f8 commit c2f9216
5 files changed
Lines changed: 172 additions & 11 deletions
File tree
- packages/flutter_client_sdk
- lib
- src
- config
- test/persistence
Lines changed: 13 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | 48 | | |
54 | 49 | | |
55 | 50 | | |
| |||
73 | 68 | | |
74 | 69 | | |
75 | 70 | | |
76 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
77 | 84 | | |
78 | 85 | | |
79 | 86 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
93 | 97 | | |
94 | 98 | | |
95 | 99 | | |
| |||
103 | 107 | | |
104 | 108 | | |
105 | 109 | | |
106 | | - | |
| 110 | + | |
| 111 | + | |
107 | 112 | | |
108 | 113 | | |
109 | 114 | | |
| |||
Lines changed: 13 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
85 | 93 | | |
86 | 94 | | |
87 | 95 | | |
| |||
121 | 129 | | |
122 | 130 | | |
123 | 131 | | |
| 132 | + | |
124 | 133 | | |
125 | 134 | | |
126 | 135 | | |
| |||
153 | 162 | | |
154 | 163 | | |
155 | 164 | | |
156 | | - | |
| 165 | + | |
| 166 | + | |
157 | 167 | | |
158 | 168 | | |
159 | 169 | | |
| |||
183 | 193 | | |
184 | 194 | | |
185 | 195 | | |
| 196 | + | |
186 | 197 | | |
187 | 198 | | |
188 | 199 | | |
| |||
195 | 206 | | |
196 | 207 | | |
197 | 208 | | |
198 | | - | |
| 209 | + | |
199 | 210 | | |
200 | 211 | | |
201 | 212 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
81 | 91 | | |
82 | 92 | | |
83 | 93 | | |
84 | | - | |
85 | | - | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
86 | 98 | | |
87 | 99 | | |
88 | 100 | | |
| |||
343 | 355 | | |
344 | 356 | | |
345 | 357 | | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
346 | 377 | | |
347 | 378 | | |
348 | 379 | | |
| |||
389 | 420 | | |
390 | 421 | | |
391 | 422 | | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
Lines changed: 97 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
899 | 899 | | |
900 | 900 | | |
901 | 901 | | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
902 | 999 | | |
0 commit comments