Repository navigation
feat: Expose flag values with their JSON type - #100
Conversation
|
@themis-blindfold review |
1 similar comment
|
@themis-blindfold review |
⚖️ Themis review: ✅ Ship itThe typed value is captured before the existing string conversion and is preserved through serialisation and cache restoration without changing
📝 Walkthrough
🧪 How to verify
Product take: Solid compatibility improvement: consumers can use remote-config numbers and booleans without reparsing strings. 🧭 Assumptions & unverified claimsNo unverified assumptions or claims. Typed values arrive intact; string parsing can take the afternoon off. · reviewed at 6d616e2 |
|
@themis-blindfold review |
⚖️ Themis review: ✅ Ship itTL;DR:
📝 Walkthrough
🧪 How to verify
Automate: Keep the typed-value parse and storage round-trip cases in Product take: Solid SDK compatibility improvement for consumers that need native remote-config values, while preserving existing callers. 🧭 Assumptions & unverified claimsNo unverified assumptions or claims. Typed values, untyped drama avoided · reviewed at 6d616e2 |
Co-authored-by: Kim Gustyr <kim.gustyr@flagsmith.com>
⚖️ Themis review: ✅ Ship itTL;DR:
📝 Walkthrough
🧪 How to verify
Product take: A solid compatibility improvement for remote-config consumers: callers can now use typed values without parsing strings themselves. 🧭 Assumptions & unverified claimsNo unverified assumptions or claims. Typed flags, untyped drama · reviewed at 5e161f9 |
Adds
Flag.value, which holds the flag's value with its JSON type: aString,num,boolornull. Until now the SDK only exposed values as strings:stateValueturns42into"42"andtrueinto"true".The change is additive.
stateValueandgetFeatureFlagValueare unchanged.Flag.fromJsonreadsvaluefrom the rawfeature_state_value.toJsonwritesvaluewith its type, so flags restored from storage keep it. Flags cached by older versions hold a string, so they still load, withvalueequal to that string.value(e.g.Flag.seed) falls back tostateValue.copyWith(stateValue: …)without avaluereplaces both.*.g.dartis unchanged:valueis excluded from codegen (includeFromJson/includeToJson: false) and handled inFlag.fromJson/toJson.Tests cover int, double, bool, string and null values, a
toJsonround trip, a restore from storage, cache data from older versions, andcopyWith.This makes the SDK behavioural spec pass in #99, which reads
flag.value.