configwire 0.0.5
configwire: ^0.0.5 copied to clipboard
Pure-Dart ConfigWire client (fetch, cache, typed getters, realtime).
0.0.5 #
Added #
- Opt-in verbose debug logging via
lite_logger(lib/src/cw_logger.dart, newlite_logger: ^0.3.0dependency). Off by default; passverbose: truetoConfigWire(...),RealtimeUpdater(...), orpostFetchEvent(...)to emit debug logs for init, cache hit/miss, fetch start/304/non-200/malformed/success, store-save failures, SSE connect/status/close, poll ticks, and the fetch-event POST. Messages are lazy closures so nothing is built whenverboseis false. TheapiKeyis never logged (only sent as theX-ConfigWire-Keyheader); caught errors are redacted before logging.ConfigWire(verbose: true)propagates to its realtime updater and fetch-event calls.
0.0.4 #
Changed #
ensureInitialized(lib/src/configwire_base.dart) is now idempotent and safe to call multiple times. Concurrent calls share the same in-flight initialization (single cache load + single forced fetch), and calls after the first attempt return immediately without re-loading the cache or re-fetching. Passing a non-nullcontextstill triggers a forcedfetchAndActivaterefresh with the new targeting, so retargeting viaensureInitializedkeeps working.
0.0.3 #
Added #
get<T>(lib/src/configwire_base.dart): generic typed getter. Returns the value forkeyasT, orfallbackwhen missing or mistyped. Coerces ints viatoDouble()whenTisdouble(parity withgetDouble). With nofallback, a missing/mistyped key returnsnullfor nullableTand throws a cast error for non-nullableT. Maps and lists are returned as defensive copies. Note: server collections decode asList<dynamic>/Map<String, dynamic>, so a directget<List<String>>over server values misses — usegetList/getMapfor those.getList<T>(lib/src/configwire_base.dart): typed list getter. Eagerly checks every element (plusint->doublecoercion whenTisdouble); defaultsfallbacktoconst []. On any error (missing key, mistyped value, or mistyped element) returnsfallback; whenfallbackis null the error is rethrown.getMap<T>(lib/src/configwire_base.dart): typed map getter. Eagerly checks every entry isString->T(plusint->doublecoercion whenTisdouble); defaultsfallbacktoconst {}. On any error (missing key, mistyped value, non-String key, or mistyped entry) returnsfallback; whenfallbackis null the error is rethrown.
Changed #
- Breaking:
getJSON(key)is removed. It returned an untypedMap<String, Object?>(or{}on miss/mistype). Migrate:getJSON('k')->getMap<Object?>('k'), or pick a value type such asgetMap<int>('k')/getMap<String>('k').
0.0.2 #
Added #
TargetingContext(lib/src/targeting.dart, exported frompackage:configwire/configwire.dart): carriesuserId,platform,appVersion,locale,country,customAttrsfor server-side rule evaluation. Empty fields are omitted from the fetch query;customAttrsis sent as?attrs=<json>. IncludescopyWith,empty, andtoQueryParameters().
Changed #
- Breaking:
fetchAndActivateandensureInitializednow take only{TargetingContext? context, bool force}. The flattenedString? userId/platform/appVersion/locale/countryandMap? customAttrsparams are removed. Migrate:fetchAndActivate(userId: 'u')->fetchAndActivate(context: const TargetingContext(userId: 'u')); single-field update ->fetchAndActivate(context: cw.targeting.copyWith(platform: 'ios')). - Targeting is sticky: a non-null
contextreplacescw.targetingfor this and all future fetches, includingconnectRealtimepoll/SSE refreshes (fetchAndActivate(force: true)reuses the stored context).setTargetingreplaces the stored context without fetching.
0.0.1 #
- Initial release of the pure-Dart
configwireclient.