agent_gate_riverpod library

Riverpod (3.x) integration for agent_gate.

Riverpod has no router of its own, so this package is intentionally small — it maps AgentGate onto Riverpod idioms:

  • gateDecisionProvider — FutureProvider.family<GateDecision, Gate>: ref.watch(gateDecisionProvider(checkoutGate)) gives you an AsyncValue<GateDecision>; render loading / data as you like.
  • GateNotifier / gateNotifierProvider — an AsyncNotifier with decide, navigate and reset, whose state is AsyncValue<GateOutcome?> (null = idle, loading = deciding, data = decided). Use it when the decision should be triggered by user action rather than by a widget being built.
  • GateListener — a ConsumerWidget that reacts to a new outcome by navigating through the configured AgentGate.adapter (or a callback), layering the loading UI while a decision is in flight.

All decision logic stays in AgentGate.instance so audit, fallbacks, allow-lists and consent behave exactly like the core.

Classes

GateArgs
Key for gateDecisionWithExtraProvider. Equality is by gate id + a stable JSON-ish rendering of extra, so identical requests share a provider instance.
GateListener
Widget-layer side-effect handler for GateNotifier.
GateNotifier
AsyncNotifier that runs gate decisions on demand.
GateOutcome
A completed decision, bundled with the gate and the resolved candidate.

Properties

gateDecisionProvider → FutureProviderFamily<GateDecision, Gate>
One-shot decision for a gate, as an AsyncValue<GateDecision>.
final
gateDecisionWithExtraProvider → FutureProviderFamily<GateDecision, GateArgs>
Like gateDecisionProvider but with per-navigation extra context.
final
gateNotifierProvider → AsyncNotifierProvider<GateNotifier, GateOutcome?>
The on-demand notifier. Keep-alive so the last outcome survives widget rebuilds; call reset() after navigating if you want a clean slate.
final

Typedefs

GateOutcomeCallback = void Function(BuildContext context, WidgetRef ref, GateOutcome outcome)
Called when a new outcome lands.