greenflags 0.3.0
greenflags: ^0.3.0 copied to clipboard
Dart/Flutter SDK for GreenFlags feature flags. Snapshot + cache reads, polling, geofence evaluation and offline persistence — evaluated at the edge.
Changelog #
Format based on Keep a Changelog. Versioning: SemVer (while in 0.x, a MINOR release may include breaking changes; strict semver applies from 1.0.0 onward).
0.3.0 - 2026-07-18 #
Added #
- Percentage rollout evaluation: flags may carry
rollout: { percentage }; the SDK buckets the current user deterministically (FNV-1a 32-bit over UTF-8 bytes of"flagKey:userKey", mod 100 — seedocs/rollout-hash-spec.md) and serves the value whenbucket < percentage, or the off value (false/null) otherwise. Conformance locked bysdks/rollout-test-vectors.json. - Multivariate flags:
variants: [{ name, weight, value }]assigned by cumulative weight ranges over the same bucket, variants ordered by name in UTF-8 byte order. A bucket beyond the total weight serves the base value. userconstructor parameter andsetUser(String?)— stable user key for bucketing; clearing reverts to an in-memory anonymous id (deterministic within the client's lifetime; pass a stableuserfor cross-session stickiness).Rollout,FlagVariant,WeightedVarianttypes androlloutBucket/assignVariantexported from the package root.
Changed #
- Evaluation chain: geofence → variants → rollout (AND; a rule with missing input is skipped). All read paths and
snapshotStreamemissions remain evaluated.
0.2.0 - 2026-07-11 #
Added #
geoDistanceMeters(a, b)— exported frompackage:greenflags/greenflags.dart. Returns the great-circle distance in meters between twoCoordinates, the same haversine calculation the SDK runs internally for geofence evaluation. Lets apps show the live distance to a geofence without reimplementing it. No behavior change to flag evaluation.
0.1.0 - 2026-07-10 #
Added #
- Initial release, mirroring
@greenflags/client0.2.x semantics in pure Dart. GreenFlagsClientwithrefresh,getSnapshot,getAllFlags,getFlag(withdefaultValue),isEnabled,snapshotStream,startPolling/stopPolling,setCoordinates,dispose.- Client-side geofence evaluation (haversine): outside the radius a
booleanflag evaluates tofalse, other types tonull. Every read path goes through evaluation — the raw snapshot is never exposed. - Offline persistence via the
SnapshotStoreinterface:hydrate()restores the last snapshot on startup;refresh()writes through. Raw flags are persisted so geofences re-evaluate against the current location after restart. - Typed
GreenFlagsExceptionwith API errorcode,messageand HTTPstatus(NETWORK_ERROR/PARSE_ERRORclient-side). - Auth via
Authorization: Bearerheader againstGET /v1/flags.