Skip to content

feat: pure Dart SDK implementation#62

Draft
nicklasl wants to merge 12 commits into
mainfrom
session/bewildered-lark-h8of
Draft

feat: pure Dart SDK implementation#62
nicklasl wants to merge 12 commits into
mainfrom
session/bewildered-lark-h8of

Conversation

@nicklasl

@nicklasl nicklasl commented Jun 8, 2026

Copy link
Copy Markdown
Member

Summary

  • Implements the Confidence SDK in pure Dart, replacing the native method channel bridge to Android/Swift SDKs
  • Flag resolution via REST POST to /v1/flags:resolve with dot-path evaluation, two-layer cache (disk + memory), and fetchAndActivate/activateAndFetchAsync strategies
  • Apply mechanism (exposure tracking) with dedup, persistence, and crash recovery via /v1/flags:apply
  • Best-effort event tracking via /v1/events:publish
  • Hierarchical context management with putContext/putContextLocal/removeContext/withContext
  • AsyncGate to serialize concurrent resolve requests + stale response discarding
  • Flutter integration: ConfidenceFlutter.create() factory wiring path_provider storage, device_info_plus enrichment, shared_preferences visitor ID
  • Legacy ConfidenceFlutterSdk class and getBool/getString/getInt/getDouble extension methods preserved for backward compat
  • Native bridge code (android/, ios/) kept alongside for parity validation — removal in follow-up PR

Test plan

  • 101 unit tests covering all components (value types, flag resolution, resolve client, apply manager, events client, storage, confidence integration)
  • flutter analyze passes with 0 errors
  • Integration test against real Confidence backend (example app dual-path)
  • Build and run on Android emulator
  • Build and run on iOS simulator

🤖 Generated with Claude Code

nicklasl and others added 12 commits June 8, 2026 08:47
Implements the foundation for a native Dart Confidence SDK:
- ConfidenceValue sealed type system with JSON serialization
- Flag resolution client (REST POST /v1/flags:resolve)
- Flag evaluation with dot-path traversal
- Apply client and manager with dedup
- Events client (best-effort)
- Storage interface with Memory and Disk implementations
- Confidence class with builder, context management
- 101 unit tests covering all components

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Auto-apply on getFlag()/getValue() when shouldApply is true
- AsyncGate serializes concurrent resolve requests
- Stale response discarding when context changes mid-fetch
- track() and flush() delegate to EventsClient
- Builder now creates ApplyManager and EventsClient

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- FlutterStorage: path_provider-based DiskStorage factory
- VisitorIdManager: UUID persistence via shared_preferences
- DeviceContextProvider: device/app/OS info via device_info_plus
- ConfidenceFlutter.create(): wires all Flutter deps automatically
- Legacy getBool/getString/getInt/getDouble extension methods
- Barrel export with all public types

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Keep the old ConfidenceFlutterSdk class and LoggingLevel enum in the
barrel export for native bridge and example app compatibility.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replaces the old ConfidenceFlutterSdk usage with
Confidence.builder() and the new typed API.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Drop the Android (Kotlin), iOS (Swift), platform interface,
method channel, and git submodule. The SDK is now pure Dart.

BREAKING CHANGE: ConfidenceFlutterSdk class and LoggingLevel
enum removed. Use Confidence.builder() or ConfidenceFlutter.create().

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Same structure as before but uses Confidence.builder() and
ConfidenceValue types instead of the native bridge.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove submodule fetch, iOS copy/delete dance, JDK setup,
and native APK/iOS builds from CI. The main CI now runs
flutter analyze + flutter test on ubuntu. Integration test
workflows kept for Android/iOS smoke tests via flutter drive.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant