ZeroAlloc.Flux
1.0.0
dotnet add package ZeroAlloc.Flux --version 1.0.0
NuGet\Install-Package ZeroAlloc.Flux -Version 1.0.0
<PackageReference Include="ZeroAlloc.Flux" Version="1.0.0" />
<PackageVersion Include="ZeroAlloc.Flux" Version="1.0.0" />
<PackageReference Include="ZeroAlloc.Flux" />
paket add ZeroAlloc.Flux --version 1.0.0
#r "nuget: ZeroAlloc.Flux, 1.0.0"
#:package ZeroAlloc.Flux@1.0.0
#addin nuget:?package=ZeroAlloc.Flux&version=1.0.0
#tool nuget:?package=ZeroAlloc.Flux&version=1.0.0
ZeroAlloc.Flux
ZeroAlloc.Flux is a source-generated, zero-allocation Flux/Redux state management library for .NET 8 and .NET 10. The Roslyn source generator wires all action dispatch at compile time — no reflection, no runtime dictionaries, no virtual dispatch. Dispatch hot path allocates 0 bytes per call when handlers complete synchronously.
Install
dotnet add package ZeroAlloc.Flux
dotnet add package ZeroAlloc.Flux.Blazor # for Blazor apps
The Roslyn generator is bundled into the ZeroAlloc.Flux package — one PackageReference gives you both runtime contracts and the generator.
Quick start
using ZeroAlloc.Flux;
// 1. Define state — record struct (recommended) or record class.
[Feature]
public readonly partial record struct CounterState(int Count);
// 2. Define actions — plain record struct, no marker interface.
public readonly record struct IncrementAction(int Amount);
public readonly record struct ResetAction;
// 3. Define reducers — static methods, [Reducer] attribute.
public static partial class CounterReducers
{
[Reducer]
public static CounterState On(CounterState state, IncrementAction action)
=> state with { Count = state.Count + action.Amount };
[Reducer]
public static CounterState On(CounterState state, ResetAction _) => new(0);
}
// 4. Register + dispatch.
services.AddZeroAllocFlux(); // Scoped by default
var dispatcher = sp.GetRequiredService<IDispatcher>();
var counter = sp.GetRequiredService<IStore<CounterState>>();
await dispatcher.DispatchAsync(new IncrementAction(5));
Console.WriteLine(counter.Value.Count); // 5
For Blazor:
public partial class Counter : FluxComponent
{
[Inject] public IStore<CounterState> CounterStore { get; set; } = default!;
[Inject] public IDispatcher Dispatcher { get; set; } = default!;
}
<p>Count: @CounterStore.Value.Count</p>
<button @onclick="async () => await Dispatcher.DispatchAsync(new IncrementAction(1))">+</button>
Why ZeroAlloc.Flux
- Compile-time dispatch. Every
DispatchAsync<TAction>overload is generated from the discovered[Reducer]set. The dispatcher is a staticswitch— no dictionary lookups, no reflection. - Zero allocation hot path. Sync-completing dispatch returns a
ValueTask.CompletedTask-equivalent — no state-machine box, no closure capture. - AOT-compatible. No reflection, no dynamic code.
<IsAotCompatible>true</IsAotCompatible>enforced on every csproj. - Flux-coherent semantics. One action, many feature listeners — fan-out matches Fluxor/Redux conventions.
- Family integration. Effects via
ZeroAlloc.Mediator.INotificationHandler<TAction>(v1.1). Notify integration viaZeroAlloc.Notify(v1.1).
Documentation
(Placeholder — full docs land in v1.0 release.)
License
MIT — see LICENSE.
| 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 is compatible. 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. |
-
net10.0
-
net8.0
NuGet packages (1)
Showing the top 1 NuGet packages that depend on ZeroAlloc.Flux:
| Package | Downloads |
|---|---|
|
ZeroAlloc.Flux.Blazor
Blazor host adapter for ZeroAlloc.Flux — FluxComponent base class and DI extensions. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 88 | 5/26/2026 |