Skip to content
pubscout

analytics_gen

2.3.0, released 4 weeks ago by shodev.live

Type-safe analytics event tracking generated from YAML configuration.

WASM-ready
$ flutter pub add analytics_gen
Source repository

What it does

Generates type-safe Dart code, documentation, and export formats from YAML-based analytics tracking plans. Enforces parameter validation, allowed values, and multi-provider logging.

AI-written summary of version 2.3.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You want to maintain a centralized analytics tracking plan in YAML and generate type-safe tracking code.
  • You need automated validation for event parameters, regex rules, and allowed values.
  • You require multi-provider fan-out and documentation outputs for stakeholders.

Skip it when

  • You prefer writing all tracking code and event names manually without external plan files.
  • You do not use YAML configurations or code generation workflows in your project.

Strengths

  • Ensures compile-time type safety for event names and parameters.
  • Generates documentation, exports, and supports multi-provider fan-out.
  • Includes validation rules and enum generation for allowed values.

Weaknesses

  • Requires maintaining and syncing separate YAML configuration files.
  • Adds a code generation step to your development workflow.

Setup

Kind
Pure Dart
Effort
Medium
Code generation
No
Direct dependencies
9

Add analytics_gen to dependencies, create your YAML tracking plan, configure analytics_gen.yaml, and run the generator via CLI.

Analytics.initialize(...);
Analytics.instance.logEvent(...);

Alternatives

Packages that do the same job and could replace analytics_gen.

Works with

Packages commonly used together with analytics_gen: ones it builds on, ones built on it, and its own family.