liquid_analytics library

Vendor-neutral analytics for Flutter: one typed event, many destinations, with a built-in consent gate.

Classes

ConsentController
Holds and mutates consent state, and answers the delivery questions the client asks: is a category decided, and may a given sink receive it.
ConsentPolicy
Declarative configuration for the consent gate.
CountFlushPolicy
Flushes after count events have been observed since the last flush.
DebugSink
A sink that logs every message it receives. Handy during development and as the reference implementation for building your own sinks.
DeliveryOptions
Configuration for offline queue, retry backoff, batching and lifecycle flush.
DeliveryStore
Persistence backend for the offline delivery queue.
FakeSink
A sink that records every message in memory, for use in tests.
FlushPolicy
Decides when the delivery engine should drain its queue.
GlobalContext
Merges a fixed set of context values into every message. App-level context (app_version, environment, …) is a good fit. Message-level context wins over these defaults.
ImmediateFlushPolicy
Signals a flush on every event. Useful with DeliveryOptions.batchMode when you still want near-immediate drain (or as a no-op marker for docs).
InMemoryDeliveryStore
Process-local queue — lost on process death. Fine for tests and as the default when the host app has not configured persistence.
JsonDeliveryStore
JSON blob store driven by host-provided callbacks.
Liquid
The analytics client: one entry point that fans every event out to all configured sinks, through the middleware pipeline and the consent gate.
LiquidEvent
Base class for strongly-typed analytics events.
LiquidMessage
The normalized, provider-agnostic envelope that flows through the pipeline.
LiquidMiddleware
A transform applied to every LiquidMessage before it reaches the sinks.
LiquidNavigatorObserver
A NavigatorObserver that emits a screen event on every route change, giving you automatic screen tracking with no per-screen instrumentation.
LiquidSink
A destination that receives analytics messages.
PiiRedactor
Replaces the values of sensitive keys in properties and traits so PII never reaches a provider.
PropertyRenamer
Renames property keys according to mapping. Useful when a destination expects a different naming convention than your app's canonical one.
QueuedEntry
One pending delivery attempt for a specific sink.
Sampler
Probabilistically drops a fraction of high-volume track events to reduce cost, optionally restricted to specific event names.
TimerFlushPolicy
Flushes on a wall-clock interval.

Enums

ConsentCategory
The privacy categories an event can belong to.
ConsentStatus
The state of consent for a ConsentCategory.
LiquidCapability
The kinds of messages a LiquidSink is able to handle.
LiquidMessageType
The kind of an analytics LiquidMessage.

Typedefs

LiquidErrorHandler = void Function(Object error, StackTrace stackTrace, LiquidSink sink)
Called when a sink throws while handling a message.