Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions docs/reference/sdks/client/dart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,35 @@ This content has been automatically generated from dart-sdk.
Edits should be made here: https://github.com/open-feature/dart-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

Last updated at Fri Oct 02 2026 08:26:00 GMT+0000 (Coordinated Universal Time)
Last updated at Tue Oct 20 2026 08:23:55 GMT+0000 (Coordinated Universal Time)
-->

# OpenFeature Dart Client SDK
This package is the vendor-neutral OpenFeature SDK for Dart client
applications. It uses the static-context paradigm. It has no Flutter or
`dart:io` dependency.

This source checkout supports Dart 3.10 or later. The published beta below
requires Dart 3.12.2 until a release containing the lower SDK floor is published.
This package supports Dart 3.10 or later within Dart 3.x. Provider packages
can require a higher Dart version; check the chosen provider separately.

The package is in beta. The first beta defines the public client and provider
contracts. It provides synchronous typed evaluation, event handlers, hooks,
ordered context changes, and an in-memory provider. Later beta changes will
complete the remaining conformance work before the first stable release.
Current package version: `0.0.1`.

**Release status:** `0.0.1` is the first non-beta client release. The SDK
remains pre-1.0.
Comment thread
jonathannorris marked this conversation as resolved.

This package provides synchronous typed
evaluation, event handlers, hooks, ordered context changes and an in-memory
provider. Pre-1.0 versions do not establish a 1.0 API compatibility commitment.
Consult the conformance matrix and release notes for accepted support scope.

## Install

The published beta requires Dart 3.12.2 or later within Dart 3.x. Flutter
The client SDK requires Dart 3.10 or later within Dart 3.x. Flutter
applications need a Flutter release that includes a compatible Dart SDK.

```yaml
dependencies:
openfeature_dart_client_sdk: ^0.0.1-beta.1
openfeature_dart_client_sdk: ^0.0.1 # x-release-please-version
```

Run `dart pub get`, or `flutter pub get` in a Flutter application.
Expand Down Expand Up @@ -114,5 +119,5 @@ dart tool/stage_client_package.dart --dry-run
```

See the
[beta release procedure](https://github.com/open-feature/dart-sdk/blob/main/doc/client-sdk-release.md)
for the first-publication bootstrap and later automated prereleases.
[client release procedure](https://github.com/open-feature/dart-sdk/blob/main/doc/client-sdk-release.md)
for non-beta release review and historical first-publication instructions.
2 changes: 1 addition & 1 deletion docs/reference/sdks/client/kotlin.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This content has been automatically generated from kotlin-sdk.
Edits should be made here: https://github.com/open-feature/kotlin-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

Last updated at Fri Oct 02 2026 08:26:00 GMT+0000 (Coordinated Universal Time)
Last updated at Tue Oct 20 2026 08:23:55 GMT+0000 (Coordinated Universal Time)
-->
import MCPInstall from '@site/src/partials/mcp-install';

Expand Down
98 changes: 94 additions & 4 deletions docs/reference/sdks/client/swift.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This content has been automatically generated from swift-sdk.
Edits should be made here: https://github.com/open-feature/swift-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

Last updated at Fri Oct 02 2026 08:26:00 GMT+0000 (Coordinated Universal Time)
Last updated at Tue Oct 20 2026 08:23:55 GMT+0000 (Coordinated Universal Time)
-->
import MCPInstall from '@site/src/partials/mcp-install';

Expand All @@ -22,8 +22,8 @@ import MCPInstall from '@site/src/partials/mcp-install';
</a>


<a href="https://github.com/open-feature/swift-sdk/releases/tag/0.6.0">
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v0.6.0&color=blue&style=for-the-badge" />
<a href="https://github.com/open-feature/swift-sdk/releases/tag/0.7.0">
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v0.7.0&color=blue&style=for-the-badge" />
</a>


Expand Down Expand Up @@ -67,7 +67,7 @@ First, ensure you have your GitHub account added as an option (+ > Add Source Co
If you manage dependencies through SPM, in the dependencies section of Package.swift add:

```swift
.package(url: "git@github.com:open-feature/swift-sdk.git", from: "0.6.0")
.package(url: "git@github.com:open-feature/swift-sdk.git", from: "0.7.0")
```

and in the target dependencies section add:
Expand Down Expand Up @@ -539,5 +539,95 @@ class BooleanHook: Hook {
}
```

#### Hook data

Each hook gets its own `hookData` store on the `HookContext`.
It is created fresh for every evaluation and shared across that hook's `before`, `after`, `error` and `finally` stages, but never with other hooks.
Use it to carry per-evaluation state (a timer, a span, a correlation ID) from one stage to the next without touching the evaluation context.

`EvaluationTimeHook` measures how long each evaluation takes by storing a timestamp in `before` and reading it back in `finally`:

```swift
class EvaluationTimeHook: Hook {
typealias HookValue = Bool

func before<HookValue>(ctx: HookContext<HookValue>, hints: [String: Any]) {
ctx.hookData["start"] = Date()
}

func finally<HookValue>(ctx: HookContext<HookValue>, details: FlagEvaluationDetails<HookValue>, hints: [String: Any]) {
guard let start = ctx.hookData["start"] as? Date else { return }
print("\(ctx.flagKey) evaluated in \(Date().timeIntervalSince(start))s")
}
}
```

`CorrelationIDHook` tags every log line of one evaluation with the same ID, whether it succeeds or fails.
Because a correlation ID is useful for every flag, it overrides `supportsFlagValueType` to run for all value types rather than only `Bool`:

```swift
class CorrelationIDHook: Hook {
typealias HookValue = Bool

func supportsFlagValueType(flagValueType: FlagValueType) -> Bool {
true
}

func before<HookValue>(ctx: HookContext<HookValue>, hints: [String: Any]) {
let correlationID = UUID().uuidString
ctx.hookData["correlationID"] = correlationID
print("[\(correlationID)] evaluating \(ctx.flagKey)")
}

func after<HookValue>(ctx: HookContext<HookValue>, details: FlagEvaluationDetails<HookValue>, hints: [String: Any]) {
print("[\(correlationID(ctx))] \(ctx.flagKey) resolved to \(details.value)")
}

func error<HookValue>(ctx: HookContext<HookValue>, error: Error, hints: [String: Any]) {
print("[\(correlationID(ctx))] \(ctx.flagKey) failed: \(error)")
}

private func correlationID<HookValue>(_ ctx: HookContext<HookValue>) -> String {
ctx.hookData["correlationID"] as? String ?? "unknown"
}
}
```

Keys are strings and values can be of any type; hook data is never serialised or sent to the provider.

#### Telemetry

`Telemetry.createEvaluationEvent` turns a finished evaluation into an [OpenTelemetry-compatible event](/specification/appendix-d): the name `feature_flag.evaluation` plus attributes such as `feature_flag.key`, `feature_flag.result.variant`, `feature_flag.result.value`, `feature_flag.result.reason`, `feature_flag.provider.name` and, when the evaluation failed, `error.type` and `error.message`.
Call it from the `finally` stage, where the evaluation details are complete, and hand the result to your telemetry client as a span event or a log record.
Attribute values are booleans, strings, integers or doubles; object and list flag values arrive as JSON strings, and attributes without a value are left out.

```swift
class TelemetryHook: Hook {
typealias HookValue = Bool

/// Forwards an event to your telemetry client, e.g. `span.addEvent(name:attributes:)` or a log record.
private let emit: (_ name: String, _ attributes: TelemetryAttributes) -> Void

init(emit: @escaping (_ name: String, _ attributes: TelemetryAttributes) -> Void) {
self.emit = emit
}

// Telemetry is useful for every flag, not only boolean ones.
func supportsFlagValueType(flagValueType: FlagValueType) -> Bool {
true
}

func finally<HookValue>(ctx: HookContext<HookValue>, details: FlagEvaluationDetails<HookValue>, hints: [String: Any]) {
let event = Telemetry.createEvaluationEvent(hookContext: ctx, evaluationDetails: details)
var attributes = event.attributes
attributes[Telemetry.Attribute.value] = nil // drop the flag value when it may be sensitive or large
emit(event.name, attributes)
}
}
```

Map each `TelemetryAttributeValue` to your client's attribute type with a `switch` over its four cases (`.boolean`, `.string`, `.integer`, `.double`).
The SDK has no OpenTelemetry dependency and the utility takes no options: filtering, redacting or truncating attributes is the hook's responsibility, as the specification recommends.

> Built a new hook? [Let us know](https://github.com/open-feature/openfeature.dev/issues/new?assignees=&labels=hook&projects=&template=document-hook.yaml&title=%5BHook%5D%3A+) so we can add it to the docs!

2 changes: 1 addition & 1 deletion docs/reference/sdks/client/web/angular.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This content has been automatically generated from js-sdk.
Edits should be made here: https://github.com/open-feature/js-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

Last updated at Fri Oct 02 2026 08:26:00 GMT+0000 (Coordinated Universal Time)
Last updated at Tue Oct 20 2026 08:23:55 GMT+0000 (Coordinated Universal Time)
-->

<p align="center" class="github-badges">
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/sdks/client/web/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This content has been automatically generated from js-sdk.
Edits should be made here: https://github.com/open-feature/js-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

Last updated at Fri Oct 02 2026 08:25:59 GMT+0000 (Coordinated Universal Time)
Last updated at Tue Oct 20 2026 08:23:54 GMT+0000 (Coordinated Universal Time)
-->
import MCPInstall from '@site/src/partials/mcp-install';

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/sdks/client/web/react.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This content has been automatically generated from js-sdk.
Edits should be made here: https://github.com/open-feature/js-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

Last updated at Fri Oct 02 2026 08:26:00 GMT+0000 (Coordinated Universal Time)
Last updated at Tue Oct 20 2026 08:23:54 GMT+0000 (Coordinated Universal Time)
-->
import MCPInstall from '@site/src/partials/mcp-install';

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/sdks/server/cpp.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This content has been automatically generated from cpp-sdk.
Edits should be made here: https://github.com/open-feature/cpp-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

Last updated at Fri Oct 02 2026 08:26:00 GMT+0000 (Coordinated Universal Time)
Last updated at Tue Oct 20 2026 08:23:55 GMT+0000 (Coordinated Universal Time)
-->

<p align="center" class="github-badges">
Expand Down
18 changes: 11 additions & 7 deletions docs/reference/sdks/server/dart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ This content has been automatically generated from dart-sdk.
Edits should be made here: https://github.com/open-feature/dart-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

Last updated at Fri Oct 02 2026 08:26:00 GMT+0000 (Coordinated Universal Time)
Last updated at Tue Oct 20 2026 08:23:55 GMT+0000 (Coordinated Universal Time)
-->

**Release status:** The server SDK has regular, non-beta releases on
[pub.dev](https://pub.dev/packages/openfeature_dart_server_sdk). It remains
pre-1.0; these releases do not establish a 1.0 API compatibility commitment.

For typed provider event registration, late-handler behavior and compatibility
with existing streams, see [the event migration guide](https://github.com/open-feature/dart-sdk/blob/main/packages/openfeature_dart_server_sdk/doc/events-migration.md).
For reusable cleanup and experimental isolated API instances, see
Expand All @@ -35,8 +39,8 @@ registration order and the compatibility decision for legacy priorities.
<img alt="Specification" src="https://img.shields.io/static/v1?label=specification&message=v0.8.0&color=yellow&style=for-the-badge" />
</a>

<a href="https://github.com/open-feature/dart-sdk/releases/tag/v0.0.26">
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v0.0.26&color=blue&style=for-the-badge" />
<a href="https://github.com/open-feature/dart-sdk/releases/tag/v0.1.0">
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v0.1.0&color=blue&style=for-the-badge" />
</a>

<a href="https://dart.dev/">
Expand Down Expand Up @@ -64,7 +68,7 @@ APIs retain their existing value and collection behavior. See the
[context migration guide](https://github.com/open-feature/dart-sdk/blob/main/packages/openfeature_dart_server_sdk/doc/evaluation-context-migration.md)
for snapshot semantics and the remaining conformance scope.

## Repository source and client SDK beta
## Repository source and client SDK

This server package now lives at
`packages/openfeature_dart_server_sdk` in the source repository. Pub.dev
Expand All @@ -76,7 +80,7 @@ repository root must add:
path: packages/openfeature_dart_server_sdk
```

The same repository also contains a separate pure-Dart client SDK beta for
The same repository also contains a separate pure-Dart client SDK for
Dart VM, Dart web, and Flutter consumers. The two packages remain independently
versioned and published.

Expand All @@ -87,7 +91,7 @@ versioned and published.
- Review the
[client SDK conformance matrix](https://github.com/open-feature/dart-sdk/blob/main/doc/client-sdk-conformance-matrix.md).
- Read the
[client beta release procedure](https://github.com/open-feature/dart-sdk/blob/main/doc/client-sdk-release.md).
[client release procedure](https://github.com/open-feature/dart-sdk/blob/main/doc/client-sdk-release.md).
- Follow [issue #117](https://github.com/open-feature/dart-sdk/issues/117)
for implementation progress.

Expand All @@ -105,7 +109,7 @@ Dart language version: [3.12.2](https://dart.dev/get-dart/archive)

```yaml
dependencies:
openfeature_dart_server_sdk: ^0.0.26
openfeature_dart_server_sdk: ^0.1.0
```

### Then run
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/sdks/server/dotnet.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This content has been automatically generated from dotnet-sdk.
Edits should be made here: https://github.com/open-feature/dotnet-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

Last updated at Fri Oct 02 2026 08:25:59 GMT+0000 (Coordinated Universal Time)
Last updated at Tue Oct 20 2026 08:23:54 GMT+0000 (Coordinated Universal Time)
-->
import MCPInstall from '@site/src/partials/mcp-install';

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/sdks/server/go.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This content has been automatically generated from go-sdk.
Edits should be made here: https://github.com/open-feature/go-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

Last updated at Fri Oct 02 2026 08:25:59 GMT+0000 (Coordinated Universal Time)
Last updated at Tue Oct 20 2026 08:23:54 GMT+0000 (Coordinated Universal Time)
-->
import MCPInstall from '@site/src/partials/mcp-install';

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/sdks/server/java.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This content has been automatically generated from java-sdk.
Edits should be made here: https://github.com/open-feature/java-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

Last updated at Fri Oct 02 2026 08:25:58 GMT+0000 (Coordinated Universal Time)
Last updated at Tue Oct 20 2026 08:23:54 GMT+0000 (Coordinated Universal Time)
-->
import MCPInstall from '@site/src/partials/mcp-install';

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/sdks/server/javascript/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This content has been automatically generated from js-sdk.
Edits should be made here: https://github.com/open-feature/js-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

Last updated at Fri Oct 02 2026 08:25:59 GMT+0000 (Coordinated Universal Time)
Last updated at Tue Oct 20 2026 08:23:54 GMT+0000 (Coordinated Universal Time)
-->
import MCPInstall from '@site/src/partials/mcp-install';

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/sdks/server/javascript/nestjs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This content has been automatically generated from js-sdk.
Edits should be made here: https://github.com/open-feature/js-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

Last updated at Fri Oct 02 2026 08:25:59 GMT+0000 (Coordinated Universal Time)
Last updated at Tue Oct 20 2026 08:23:54 GMT+0000 (Coordinated Universal Time)
-->
import MCPInstall from '@site/src/partials/mcp-install';

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/sdks/server/php.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This content has been automatically generated from php-sdk.
Edits should be made here: https://github.com/open-feature/php-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

Last updated at Fri Oct 02 2026 08:25:59 GMT+0000 (Coordinated Universal Time)
Last updated at Tue Oct 20 2026 08:23:54 GMT+0000 (Coordinated Universal Time)
-->
import MCPInstall from '@site/src/partials/mcp-install';

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/sdks/server/python.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This content has been automatically generated from python-sdk.
Edits should be made here: https://github.com/open-feature/python-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

Last updated at Fri Oct 02 2026 08:25:59 GMT+0000 (Coordinated Universal Time)
Last updated at Tue Oct 20 2026 08:23:54 GMT+0000 (Coordinated Universal Time)
-->
import MCPInstall from '@site/src/partials/mcp-install';

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/sdks/server/ruby.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This content has been automatically generated from ruby-sdk.
Edits should be made here: https://github.com/open-feature/ruby-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

Last updated at Fri Oct 02 2026 08:26:00 GMT+0000 (Coordinated Universal Time)
Last updated at Tue Oct 20 2026 08:23:55 GMT+0000 (Coordinated Universal Time)
-->
import MCPInstall from '@site/src/partials/mcp-install';

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/sdks/server/rust.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This content has been automatically generated from rust-sdk.
Edits should be made here: https://github.com/open-feature/rust-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

Last updated at Fri Oct 02 2026 08:26:00 GMT+0000 (Coordinated Universal Time)
Last updated at Tue Oct 20 2026 08:23:55 GMT+0000 (Coordinated Universal Time)
-->

<p align="center" class="github-badges">
Expand Down
8 changes: 4 additions & 4 deletions src/datasets/sdks/sdk-compatibility.json
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,8 @@
"path": "/docs/reference/sdks/client/swift",
"category": "Client",
"release": {
"href": "https://github.com/open-feature/swift-sdk/releases/tag/0.6.0",
"version": "0.6.0",
"href": "https://github.com/open-feature/swift-sdk/releases/tag/0.7.0",
"version": "0.7.0",
"stable": false
},
"spec": {
Expand Down Expand Up @@ -592,8 +592,8 @@
"path": "/docs/reference/sdks/server/dart",
"category": "Server",
"release": {
"href": "https://github.com/open-feature/dart-sdk/releases/tag/v0.0.26",
"version": "0.0.26",
"href": "https://github.com/open-feature/dart-sdk/releases/tag/v0.1.0",
"version": "0.1.0",
"stable": false
},
"spec": {
Expand Down
Loading