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 anAsyncValue<GateDecision>; render loading / data as you like. - GateNotifier / gateNotifierProvider — an
AsyncNotifierwithdecide,navigateandreset, whose state isAsyncValue<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
ConsumerWidgetthat reacts to a new outcome by navigating through the configuredAgentGate.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
-
AsyncNotifierthat 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
extracontext.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.