analytics_toolkit 0.1.1
analytics_toolkit: ^0.1.1 copied to clipboard
A pure-Dart in-memory query engine for dashboard-style analytics over normalized record collections. Renderer-agnostic.
Change Log #
2026-05-28 #
Changes #
Packages with breaking changes:
- There are no breaking changes in this release.
Packages with other changes:
analytics_toolkit - v0.1.1
0.1.0 #
Initial release.
analytics_toolkit is a pure-Dart in-memory query engine for dashboard-style analytics over normalized record collections. Hosts declare data sources, build typed queries with measures and group-bys, and read back typed results — no chart library, no UI toolkit, no Flutter dependency. The host streams SourceRecords in; the executor returns AnalyticsResult out.
This release establishes the foundational API surface:
- Schema and values —
SourceDefandFieldDeffor declaring sources, with a sealedTypedValuefamily (StringValue,IntValue,DoubleValue,BoolValue,EnumValue,DateTimeValue,DurationValue, list variants,NullValue) and a single canonical ordering viaTypedValueOrdering. - Queries — up to five measures per query from a sealed measure family (
CountMeasure,FieldMeasurewith a sealedFieldAggregationfamily —SumAgg,AverageAgg,MinAgg,MaxAgg,DistinctCountAgg,PercentileAgg— andStreakMeasure); up to three group-bys from a sealed group-by family (FieldGroupBy,TimeGroupBy); AND-combined record-level filters; bucket-level filtering viaHavingClause; sorts with SQL-style null ordering; and derived operations (CumulativeSumOp,DeltaOp,MovingAverageOp) applied after aggregation. - Results — sealed result family (
ScalarResult,SeriesResult,MultiSeriesResult,MultiMeasureSeriesResult,TableResult) with a unifiedBucketKeyfamily andBucketKeyOrderingas the single source of truth for ordering. - Validation —
QueryValidatorreturnsResult<Unit, AnalyticsError>with a closedAnalyticsErrorKindenum. The executor never throws for validation failures. - Execution —
AnalyticsExecutor.executeis a pure function:(query, records, sources) -> Result<AnalyticsResult, AnalyticsError>. Deterministic, no wall-clock reads, no hidden state. - Time series — calendar-aligned date-range presets via
DatePresetResolver, configurable week-start and quarter-start, half-open[start, end)ranges, date-range projection viaDateRangeProjector, and time-bucket densification so charts render without gaps. - Paired queries —
PairedQuerySpecfor cohort comparison and rate displays, with alignability validation across sources. - Persistence —
AnalyticsWidgetSpecplusWidgetPayloadCodecround-trip user-built widget specs to JSON with a schema-version guard for forward compatibility. - Caching and change events —
SourceSnapshotCachefor records-layer caching (in-flight dedup, scoped invalidation, discard-on-completion for stale fetches) andAnalyticsChange/AnalyticsChangeKindfor typed listener invalidation. - Zero external dependencies — only
dart:coreanddart:convert.ndAnalyticsChange/AnalyticsChangeKindfor typed listener invalidation. - Zero external dependencies — only
dart:coreanddart:convert.