Overview
analytics_gen is a Flutter package that enables type-safe analytics event tracking through code generation from YAML configuration. It supports multiple analytics providers, offers built-in testing utilities, and allows exporting event definitions to various formats. By defining events in a centralized YAML file, developers ensure consistency and reduce runtime errors. The generated code enforces correct event structure and parameters, improving maintainability and developer experience across platforms.
Use cases
- Tracking user interactions in apps
- Centralizing analytics event definitions
- Generating testable analytics code
- Supporting multiple analytics backends
- Enabling cross-platform analytics
- Simplifying onboarding for new team members
Key features
- Code generation from YAML
- Type-safe event tracking
- Multi-provider support
- Built-in testing utilities
- Export to multiple formats
- Cross-platform compatibility
Suitable for
- Teams using structured analytics
- Projects requiring consistent event naming
- Developers prioritizing type safety
- Apps with multiple analytics providers
- Teams focused on maintainable code
- CI/CD pipelines with automated validation
Considerations
- Requires YAML configuration setup
- Initial learning curve for YAML schema
- Limited to generated event types
- May require updates when adding new events
- Dependent on code generation step
- Not suitable for dynamic event creation