diff --git a/docs/reference/sdks/client/kotlin.mdx b/docs/reference/sdks/client/kotlin.mdx index feffa0292..5341b3cd8 100644 --- a/docs/reference/sdks/client/kotlin.mdx +++ b/docs/reference/sdks/client/kotlin.mdx @@ -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 Mon Apr 13 2026 08:52:16 GMT+0000 (Coordinated Universal Time) +Last updated at Fri Apr 17 2026 08:43:12 GMT+0000 (Coordinated Universal Time) --> import MCPInstall from '@site/src/partials/mcp-install'; @@ -100,7 +100,7 @@ coroutineScope.launch(Dispatchers.Default) { val client = OpenFeatureAPI.getClient() // get a bool flag value - client.getBooleanValue("boolFlag", default = false) + client.getBooleanValue("boolFlag", defaultValue = false) } ``` @@ -227,7 +227,7 @@ Please refer to the documentation of the provider you're using to see what event Example usage: ```kotlin viewModelScope.launch { - OpenFeatureAPI.observe().collect { + OpenFeatureAPI.observe().collect { println(">> Provider event received") } } @@ -235,8 +235,8 @@ viewModelScope.launch { viewModelScope.launch { OpenFeatureAPI.setProviderAndWait( MyFeatureProvider(), - Dispatchers.Default, - myEvaluationContext + myEvaluationContext, + Dispatchers.Default ) } ``` @@ -257,7 +257,9 @@ The OpenFeature API provides a close function to perform a cleanup of the regist This should only be called when your application is in the process of shutting down. ```kotlin -OpenFeatureAPI.shutdown() +coroutineScope.launch { + OpenFeatureAPI.shutdown() +} ``` ## Sample app @@ -276,7 +278,7 @@ To develop a provider, you need to create a new project and include the OpenFeat You’ll then need to write the provider by implementing the `FeatureProvider` interface exported by the OpenFeature SDK. ```kotlin -class NewProvider(override val hooks: List>, override val metadata: Metadata) : FeatureProvider { +class NewProvider(override val hooks: List>, override val metadata: ProviderMetadata) : FeatureProvider { override fun getBooleanEvaluation( key: String, defaultValue: Boolean, diff --git a/docs/reference/sdks/client/swift.mdx b/docs/reference/sdks/client/swift.mdx index 270175199..dd28ff84e 100644 --- a/docs/reference/sdks/client/swift.mdx +++ b/docs/reference/sdks/client/swift.mdx @@ -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 Mon Apr 13 2026 08:52:16 GMT+0000 (Coordinated Universal Time) +Last updated at Fri Apr 17 2026 08:43:12 GMT+0000 (Coordinated Universal Time) --> import MCPInstall from '@site/src/partials/mcp-install'; diff --git a/docs/reference/sdks/client/web/angular.mdx b/docs/reference/sdks/client/web/angular.mdx index e539a615c..4947aa5f4 100644 --- a/docs/reference/sdks/client/web/angular.mdx +++ b/docs/reference/sdks/client/web/angular.mdx @@ -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 Mon Apr 13 2026 08:52:16 GMT+0000 (Coordinated Universal Time) +Last updated at Fri Apr 17 2026 08:43:12 GMT+0000 (Coordinated Universal Time) -->

diff --git a/docs/reference/sdks/client/web/index.mdx b/docs/reference/sdks/client/web/index.mdx index 02d955cdc..fa5cd721d 100644 --- a/docs/reference/sdks/client/web/index.mdx +++ b/docs/reference/sdks/client/web/index.mdx @@ -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 Mon Apr 13 2026 08:52:16 GMT+0000 (Coordinated Universal Time) +Last updated at Fri Apr 17 2026 08:43:12 GMT+0000 (Coordinated Universal Time) --> import MCPInstall from '@site/src/partials/mcp-install'; diff --git a/docs/reference/sdks/client/web/react.mdx b/docs/reference/sdks/client/web/react.mdx index 107c1981b..6a7683903 100644 --- a/docs/reference/sdks/client/web/react.mdx +++ b/docs/reference/sdks/client/web/react.mdx @@ -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 Mon Apr 13 2026 08:52:16 GMT+0000 (Coordinated Universal Time) +Last updated at Fri Apr 17 2026 08:43:12 GMT+0000 (Coordinated Universal Time) --> import MCPInstall from '@site/src/partials/mcp-install'; diff --git a/docs/reference/sdks/server/dart.mdx b/docs/reference/sdks/server/dart.mdx index 546520606..2f7707b3c 100644 --- a/docs/reference/sdks/server/dart.mdx +++ b/docs/reference/sdks/server/dart.mdx @@ -9,7 +9,7 @@ This content has been automatically generated from dart-server-sdk. Edits should be made here: https://github.com/open-feature/dart-server-sdk Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs -Last updated at Mon Apr 13 2026 08:52:16 GMT+0000 (Coordinated Universal Time) +Last updated at Fri Apr 17 2026 08:43:12 GMT+0000 (Coordinated Universal Time) -->

@@ -19,8 +19,8 @@ Last updated at Mon Apr 13 2026 08:52:16 GMT+0000 (Coordinated Universal Time) - - Release + + Release @@ -47,7 +47,7 @@ Last updated at Mon Apr 13 2026 08:52:16 GMT+0000 (Coordinated Universal Time) ### Requirements -Dart language version: [3.9.2](https://dart.dev/get-dart/archive) +Dart language version: [3.10.7](https://dart.dev/get-dart/archive) > [!NOTE] > The OpenFeature DartServer SDK only supports the latest currently maintained Dart language versions. @@ -56,7 +56,7 @@ Dart language version: [3.9.2](https://dart.dev/get-dart/archive) ```yaml dependencies: - openfeature_dart_server_sdk: ^0.0.17 + openfeature_dart_server_sdk: ^0.0.18 ``` ### Then run: @@ -75,7 +75,7 @@ import 'package:openfeature_dart_server_sdk/feature_provider.dart'; void main() async { // Get the API instance final api = OpenFeatureAPI(); - + // Register your feature flag provider and wait for it to be ready await api.setProviderAndWait(InMemoryProvider({ 'new-feature': true, @@ -159,13 +159,14 @@ api.setGlobalContext(OpenFeatureEvaluationContext({ 'region': 'us-east-1-iah-1a', })); -// Create a client with a specific evaluation context +// Create a client with a client-level default context final client = FeatureClient( metadata: ClientMetadata(name: 'my-app'), hookManager: HookManager(), defaultContext: EvaluationContext(attributes: { 'version': '1.4.6', }), + provider: api.provider, ); // Set a value to the invocation context @@ -200,13 +201,13 @@ final client = FeatureClient( metadata: ClientMetadata(name: 'my-app'), hookManager: hookManager, defaultContext: EvaluationContext(attributes: {}), + provider: api.provider, ); - -// Create a hook for a specific evaluation -final myHook = MyHook(); -// You can use the hook with a specific evaluation ``` +> [!NOTE] +> Invocation-level hooks are not yet supported. Hooks can currently be registered at the global or client level. + ### Tracking The [tracking API](/specification/sections/tracking/) allows you to use OpenFeature abstractions and objects to associate user actions with feature flag evaluations. @@ -239,49 +240,10 @@ await client.track( Note that in accordance with the OpenFeature specification, the SDK doesn't generally log messages during flag evaluation. -#### Logging Hook - -The Dart SDK includes a `LoggingHook`, which logs detailed information at key points during flag evaluation, using the [package:logging](https://pub.dev/packages/logging) structured logging API. -This hook can be particularly helpful for troubleshooting and debugging; simply attach it at the global, client or invocation level and ensure your log level is set to "debug". - -##### Usage example - -```dart -import 'package:logging/logging.dart'; -import 'package:openfeature_dart_server_sdk/hooks.dart'; - -// Configure logging -Logger.root.level = Level.ALL; -Logger.root.onRecord.listen((record) { - print('${record.time} [${record.level.name}] ${record.message}'); -}); - -// Create a logging hook -final loggingHook = LoggingHook(); - -// Add the hook to your hook manager -final hookManager = HookManager(); -hookManager.addHook(loggingHook); - -// Create a client using this hook manager -final client = FeatureClient( - metadata: ClientMetadata(name: 'test-client'), - hookManager: hookManager, - defaultContext: EvaluationContext(attributes: {}), -); - -// Evaluate a flag -final result = await client.getBooleanFlag('my-flag', defaultValue: false); -``` - -###### Output - -```sh -{"time":"2024-10-23T13:33:09.8870867+03:00","level":"DEBUG","msg":"Before stage","domain":"test-client","provider_name":"InMemoryProvider","flag_key":"not-exist","default_value":true} -{"time":"2024-10-23T13:33:09.8968242+03:00","level":"ERROR","msg":"Error stage","domain":"test-client","provider_name":"InMemoryProvider","flag_key":"not-exist","default_value":true,"error_message":"error code: FLAG_NOT_FOUND: flag for key not-exist not found"} -``` +The SDK uses the [package:logging](https://pub.dev/packages/logging) structured logging API internally. +You can configure log levels and listeners to capture SDK log output for troubleshooting and debugging. -See [hooks](#hooks) for more information on configuring hooks. +See [hooks](#hooks) for more information on adding custom logging behavior via hooks. ### Domains @@ -302,10 +264,12 @@ api.setProvider(InMemoryProvider({'default-flag': true})); api.bindClientToProvider('cache-domain', 'CachedProvider'); // Client backed by default provider -api.evaluateBooleanFlag('my-flag', 'default-client'); +final defaultClient = api.getClient('default-client'); +await defaultClient.getBooleanFlag('my-flag', defaultValue: false); // Client backed by CachedProvider -api.evaluateBooleanFlag('my-flag', 'cache-domain'); +final cacheClient = api.getClient('cache-client', domain: 'cache-domain'); +await cacheClient.getBooleanFlag('my-flag', defaultValue: false); ``` ### Eventing @@ -323,19 +287,28 @@ import 'package:openfeature_dart_server_sdk/open_feature_event.dart'; // Get the OpenFeature API instance final api = OpenFeatureAPI(); -// Listen for provider change events +// Listen for provider configuration change events api.events.listen((event) { - if (event.type == OpenFeatureEventType.providerChanged) { - print('Provider changed: ${event.message}'); + if (event.type == OpenFeatureEventType.PROVIDER_CONFIGURATION_CHANGED) { + print('Provider configuration changed: ${event.message}'); } }); +``` + +The SDK also provides a global event bus for flag evaluation events: + +```dart +import 'package:openfeature_dart_server_sdk/event_system.dart'; // Listen for flag evaluation events -api.events.listen((event) { - if (event.type == OpenFeatureEventType.flagEvaluated) { +OpenFeatureEvents.instance.subscribe( + (event) { print('Flag evaluated: ${event.data['flagKey']} = ${event.data['result']}'); - } -}); + }, + filter: EventFilter( + types: {OpenFeatureEventType.flagEvaluated}, + ), +); ``` ### Shutdown @@ -373,7 +346,7 @@ Transaction context can be set where specific data is available (e.g. an auth se ```dart import 'package:openfeature_dart_server_sdk/transaction_context.dart'; -// Create a transaction context manager +// Get the transaction context manager (singleton) final transactionManager = TransactionContextManager(); // Set the transaction context @@ -418,6 +391,9 @@ class MyCustomProvider implements FeatureProvider { @override String get name => 'MyCustomProvider'; + @override + ProviderMetadata get metadata => ProviderMetadata(name: name); + @override ProviderState get state => ProviderState.READY; @@ -531,9 +507,9 @@ class MyCustomProvider implements FeatureProvider { To develop a hook, you need to create a new project and include the OpenFeature SDK as a dependency. This can be a new repository or included in [the existing contrib repository](https://github.com/open-feature/dart-server-sdk-contrib) available under the OpenFeature organization. -Implement your own hook by conforming to the [Hook interface](https://github.com/open-feature/dart-server-sdk/blob/main/pkg/openfeature/hooks.dart). -To satisfy the interface, all methods (`Before`/`After`/`Finally`/`Error`) need to be defined. -To avoid defining empty functions make use of the `UnimplementedHook` struct (which already implements all the empty functions). +Implement your own hook by conforming to the [Hook interface](https://github.com/open-feature/dart-server-sdk/blob/main/lib/hooks.dart). +To satisfy the interface, all methods (`before`/`after`/`finally_`/`error`) need to be defined. +To avoid defining empty functions, extend the `BaseHook` class (which provides no-op default implementations for all methods). ```dart import 'dart:async'; @@ -577,10 +553,8 @@ class MyCustomHook extends BaseHook { ## Testing -The SDK provides a `NewTestProvider` which allows you to set flags for the scope of a test. -The `TestProvider` is thread-safe and can be used in tests that run in parallel. - -Call `testProvider.UsingFlags(t, tt.flags)` to set flags for a test, and clean them up with `testProvider.Cleanup()` +Use the `InMemoryProvider` to set flags for the scope of a test. +Use `OpenFeatureAPI.resetInstance()` in `tearDown` to clean up between tests. ```dart import 'package:test/test.dart'; diff --git a/docs/reference/sdks/server/dotnet.mdx b/docs/reference/sdks/server/dotnet.mdx index 3d9ce667c..50905c4b8 100644 --- a/docs/reference/sdks/server/dotnet.mdx +++ b/docs/reference/sdks/server/dotnet.mdx @@ -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 Mon Apr 13 2026 08:52:15 GMT+0000 (Coordinated Universal Time) +Last updated at Fri Apr 17 2026 08:43:11 GMT+0000 (Coordinated Universal Time) --> import MCPInstall from '@site/src/partials/mcp-install'; diff --git a/docs/reference/sdks/server/go.mdx b/docs/reference/sdks/server/go.mdx index 822b81010..f307426fd 100644 --- a/docs/reference/sdks/server/go.mdx +++ b/docs/reference/sdks/server/go.mdx @@ -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 Mon Apr 13 2026 08:52:15 GMT+0000 (Coordinated Universal Time) +Last updated at Fri Apr 17 2026 08:43:11 GMT+0000 (Coordinated Universal Time) --> import MCPInstall from '@site/src/partials/mcp-install'; diff --git a/docs/reference/sdks/server/java.mdx b/docs/reference/sdks/server/java.mdx index df0194496..90c01cdc6 100644 --- a/docs/reference/sdks/server/java.mdx +++ b/docs/reference/sdks/server/java.mdx @@ -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 Mon Apr 13 2026 08:52:15 GMT+0000 (Coordinated Universal Time) +Last updated at Fri Apr 17 2026 08:43:11 GMT+0000 (Coordinated Universal Time) --> import MCPInstall from '@site/src/partials/mcp-install'; diff --git a/docs/reference/sdks/server/javascript/index.mdx b/docs/reference/sdks/server/javascript/index.mdx index 52abbf030..7819e715d 100644 --- a/docs/reference/sdks/server/javascript/index.mdx +++ b/docs/reference/sdks/server/javascript/index.mdx @@ -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 Mon Apr 13 2026 08:52:15 GMT+0000 (Coordinated Universal Time) +Last updated at Fri Apr 17 2026 08:43:11 GMT+0000 (Coordinated Universal Time) --> import MCPInstall from '@site/src/partials/mcp-install'; diff --git a/docs/reference/sdks/server/javascript/nestjs.mdx b/docs/reference/sdks/server/javascript/nestjs.mdx index ebc46c3e1..ef67674f0 100644 --- a/docs/reference/sdks/server/javascript/nestjs.mdx +++ b/docs/reference/sdks/server/javascript/nestjs.mdx @@ -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 Mon Apr 13 2026 08:52:15 GMT+0000 (Coordinated Universal Time) +Last updated at Fri Apr 17 2026 08:43:11 GMT+0000 (Coordinated Universal Time) --> import MCPInstall from '@site/src/partials/mcp-install'; diff --git a/docs/reference/sdks/server/php.mdx b/docs/reference/sdks/server/php.mdx index 8d57bff63..8acdb6568 100644 --- a/docs/reference/sdks/server/php.mdx +++ b/docs/reference/sdks/server/php.mdx @@ -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 Mon Apr 13 2026 08:52:15 GMT+0000 (Coordinated Universal Time) +Last updated at Fri Apr 17 2026 08:43:12 GMT+0000 (Coordinated Universal Time) --> import MCPInstall from '@site/src/partials/mcp-install'; diff --git a/docs/reference/sdks/server/python.mdx b/docs/reference/sdks/server/python.mdx index dfcb8bf80..0b98f1e1b 100644 --- a/docs/reference/sdks/server/python.mdx +++ b/docs/reference/sdks/server/python.mdx @@ -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 Mon Apr 13 2026 08:52:15 GMT+0000 (Coordinated Universal Time) +Last updated at Fri Apr 17 2026 08:43:11 GMT+0000 (Coordinated Universal Time) --> import MCPInstall from '@site/src/partials/mcp-install'; diff --git a/docs/reference/sdks/server/ruby.mdx b/docs/reference/sdks/server/ruby.mdx index 5bbaab19b..b1c53d901 100644 --- a/docs/reference/sdks/server/ruby.mdx +++ b/docs/reference/sdks/server/ruby.mdx @@ -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 Mon Apr 13 2026 08:52:16 GMT+0000 (Coordinated Universal Time) +Last updated at Fri Apr 17 2026 08:43:12 GMT+0000 (Coordinated Universal Time) --> import MCPInstall from '@site/src/partials/mcp-install'; diff --git a/docs/reference/sdks/server/rust.mdx b/docs/reference/sdks/server/rust.mdx index c6b093bb2..0d877af95 100644 --- a/docs/reference/sdks/server/rust.mdx +++ b/docs/reference/sdks/server/rust.mdx @@ -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 Mon Apr 13 2026 08:52:16 GMT+0000 (Coordinated Universal Time) +Last updated at Fri Apr 17 2026 08:43:12 GMT+0000 (Coordinated Universal Time) -->

diff --git a/src/datasets/sdks/sdk-compatibility.json b/src/datasets/sdks/sdk-compatibility.json index c622bcb54..e8aa68286 100644 --- a/src/datasets/sdks/sdk-compatibility.json +++ b/src/datasets/sdks/sdk-compatibility.json @@ -592,8 +592,8 @@ "path": "/docs/reference/sdks/server/dart", "category": "Server", "release": { - "href": "https://github.com/open-feature/dart-server-sdk/releases/tag/v0.0.17", - "version": "0.0.17", + "href": "https://github.com/open-feature/dart-server-sdk/releases/tag/v0.0.18", + "version": "0.0.18", "stable": false }, "spec": {