OmniFlags.Sdk
1.0.19
dotnet add package OmniFlags.Sdk --version 1.0.19
NuGet\Install-Package OmniFlags.Sdk -Version 1.0.19
<PackageReference Include="OmniFlags.Sdk" Version="1.0.19" />
<PackageVersion Include="OmniFlags.Sdk" Version="1.0.19" />
<PackageReference Include="OmniFlags.Sdk" />
paket add OmniFlags.Sdk --version 1.0.19
#r "nuget: OmniFlags.Sdk, 1.0.19"
#:package OmniFlags.Sdk@1.0.19
#addin nuget:?package=OmniFlags.Sdk&version=1.0.19
#tool nuget:?package=OmniFlags.Sdk&version=1.0.19
OmniFlags .NET SDK
.NET SDK for OmniFlags. Supports ASP.NET Core, Worker Services, and standalone apps.
Installation
dotnet add package OmniFlags.Sdk
ASP.NET Core / Generic Host
Register the SDK in Program.cs:
builder.Services.AddOmniFlags(options =>
{
options.SdkKey = "your-sdk-key";
});
The SDK initializes and starts background polling automatically as a hosted service. Inject OmniFlagsClient wherever you need it:
public class ProductController(OmniFlagsClient flags) : ControllerBase
{
[HttpGet("/products")]
public IActionResult Get()
{
var newLayout = flags.IsEnabled("store.new-product-layout");
return Ok(newLayout ? GetNewLayout() : GetLegacyLayout());
}
}
Standalone usage
var httpClient = new HttpClient();
var client = new OmniFlagsClient(new OmniFlagsOptions { SdkKey = "your-sdk-key" }, httpClient);
await client.InitializeAsync();
var enabled = client.IsEnabled("store.dark-mode");
Call client.Dispose() when done to stop polling and flush metrics.
Configuration
| Property | Type | Description |
|---|---|---|
SdkKey |
string |
Required. SDK key from the OmniFlags dashboard. |
Load from appsettings.json
{
"OmniFlags": {
"SdkKey": "your-sdk-key"
}
}
builder.Services.AddOmniFlags(options =>
builder.Configuration.GetSection("OmniFlags").Bind(options));
Evaluation
Flag keys are namespaced by project: {projectKey}.{flagKey}.
// Boolean
bool enabled = client.IsEnabled("store.show-banner");
// Typed value methods
bool dark = client.GetBoolean("store.dark-mode", false);
string theme = client.GetString("store.theme", "light");
double ratio = client.GetNumber("store.ab-weight", 0.5);
// Generic — for complex types
var config = client.GetValue<MyConfig>("store.config", defaultConfig);
// Full result (variant, reason, rule matched)
EvaluationResult result = client.GetVariant("store.show-banner");
// result.Value, result.Variant, result.Reason, result.RuleId, result.ErrorCode
Context
Pass context per evaluation call — customer, business, branch, country, etc. There is no persistent context state on the client.
var ctx = new EvaluationContext
{
CustomerId = request.CustomerId,
AgentId = request.AgentId,
BusinessId = request.BusinessId,
BusinessBranchId = request.BusinessBranchId,
};
bool enabled = client.IsEnabled("store.show-banner", ctx);
string theme = client.GetString("store.theme", "light", ctx);
Status
ProviderStatus status = client.Status; // NotReady | Ready | Stale | Error
// Wait until the first snapshot is loaded before serving traffic
await client.WaitForReadyAsync();
Polling runs in the background on a server-driven interval (default: 5 minutes). If a poll fails but a previous snapshot exists, status moves to Stale and evaluations continue against the last known flags.
Target frameworks
.NET 8.0+
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Microsoft.Extensions.Hosting.Abstractions (>= 8.0.1)
- Microsoft.Extensions.Http (>= 8.0.1)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.2)
- System.Text.Json (>= 8.0.5)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.19 | 143 | 3/29/2026 |
| 1.0.18 | 117 | 3/29/2026 |
| 1.0.17 | 124 | 3/29/2026 |
| 1.0.16 | 122 | 3/29/2026 |
| 1.0.15 | 177 | 3/28/2026 |
| 1.0.14 | 118 | 3/24/2026 |
| 1.0.13 | 116 | 3/24/2026 |
| 1.0.12 | 113 | 3/24/2026 |
| 1.0.11 | 113 | 3/23/2026 |
| 1.0.10 | 114 | 3/22/2026 |
| 1.0.9 | 106 | 3/22/2026 |
| 1.0.8 | 110 | 3/22/2026 |
| 1.0.7 | 110 | 3/22/2026 |
| 1.0.6 | 112 | 3/22/2026 |
| 1.0.5 | 109 | 3/22/2026 |
| 1.0.4 | 107 | 3/22/2026 |
| 1.0.3 | 105 | 3/22/2026 |
| 1.0.2 | 110 | 3/22/2026 |
| 1.0.1 | 111 | 3/22/2026 |
| 1.0.0 | 112 | 3/21/2026 |