ZeroAlloc.Flux.Blazor 1.0.0

dotnet add package ZeroAlloc.Flux.Blazor --version 1.0.0
                    
NuGet\Install-Package ZeroAlloc.Flux.Blazor -Version 1.0.0
                    
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="ZeroAlloc.Flux.Blazor" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ZeroAlloc.Flux.Blazor" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="ZeroAlloc.Flux.Blazor" />
                    
Project file
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 ZeroAlloc.Flux.Blazor --version 1.0.0
                    
#r "nuget: ZeroAlloc.Flux.Blazor, 1.0.0"
                    
#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 ZeroAlloc.Flux.Blazor@1.0.0
                    
#: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=ZeroAlloc.Flux.Blazor&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=ZeroAlloc.Flux.Blazor&version=1.0.0
                    
Install as a Cake Tool

ZeroAlloc.Flux

NuGet Build License: MIT AOT

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 static switch — 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 via ZeroAlloc.Notify (v1.1).

Documentation

(Placeholder — full docs land in v1.0 release.)

License

MIT — see LICENSE.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.0 48 5/26/2026