FlagSwift 1.0.1
dotnet add package FlagSwift --version 1.0.1
NuGet\Install-Package FlagSwift -Version 1.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="FlagSwift" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FlagSwift" Version="1.0.1" />
<PackageReference Include="FlagSwift" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add FlagSwift --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: FlagSwift, 1.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package FlagSwift@1.0.1
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=FlagSwift&version=1.0.1
#tool nuget:?package=FlagSwift&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
FlagSwift .NET SDK
Official .NET client for FlagSwift feature flags. Supports .NET 6, .NET 8, and .NET Standard 2.1.
Installation
dotnet add package FlagSwift
Quick Start
using FlagSwift;
var client = new FlagSwiftClient(new FlagSwiftConfig
{
ApiKey = "fs_server_your_key_here",
Environment = "production"
});
await client.InitializeAsync();
var user = new FlagSwiftUser("user-123");
if (client.IsEnabled("new-dashboard", user))
{
Console.WriteLine("showing new dashboard");
}
ASP.NET Core example
// Program.cs
builder.Services.AddSingleton(sp =>
{
var client = new FlagSwiftClient(new FlagSwiftConfig
{
ApiKey = builder.Configuration["FlagSwift:ServerKey"]!,
Environment = "production"
});
client.InitializeAsync().GetAwaiter().GetResult();
return client;
});
// In a controller or minimal API endpoint
app.MapGet("/api/data", (FlagSwiftClient flags) =>
{
var user = new FlagSwiftUser("user@example.com");
return flags.IsEnabled("new-api", user)
? Results.Ok(new { version = "v2" })
: Results.Ok(new { version = "v1" });
});
Configuration
| Option | Type | Default |
|---|---|---|
ApiKey |
string |
required |
Environment |
string |
"production" |
BaseUrl |
string |
"https://flagswift.com" |
Timeout |
TimeSpan |
5s |
CacheTimeout |
TimeSpan |
5m |
MaxRetries |
int |
3 |
RefreshInterval |
TimeSpan? |
null (disabled) |
FailsafeFallbacks |
Dictionary<string,bool> |
{} |
KillSwitchFallbacks |
Dictionary<string,bool> |
{} |
GlobalIdentifier |
List<string>? |
null |
Kill switch
await client.ActivateKillSwitchAsync(new[] { "problematic-feature" }, new[] { "production" });
await client.DeactivateKillSwitchAsync(new[] { "problematic-feature" }, new[] { "production" });
client.IsKillSwitchEnabled();
Dispose
FlagSwiftClient implements IDisposable. If you set RefreshInterval, dispose the client on shutdown (or register it as a singleton and let the DI container handle it):
client.Dispose();
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- No dependencies.
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.