Skip to content

Commit 092d20f

Browse files
committed
@d update README for clarity and consistency
1 parent 72b7652 commit 092d20f

1 file changed

Lines changed: 28 additions & 28 deletions

File tree

README.md

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,14 @@ This removes brittle, hand‑written string keys, prevents drift across platform
7171

7272
## Key features
7373

74-
- **Type‑safe analytics** compile‑time checking of event names and parameter types
75-
- **YAML → Dart generation** write your plan once; emit strongly‑typed methods
76-
- **Domain-per-file** a clean file per domain for readable diffs and code review
77-
- **Multi‑provider support** fan‑out events to multiple analytics backends
78-
- **Exports & docs** optional CSV/JSON/SQL/SQLite and generated Markdown for stakeholders
79-
- **Deterministic output** fingerprinted and sorted generation prevents noisy diffs
80-
- **Watch mode & cleanup** safe incremental regeneration; outputs cleaned before emit
81-
- **Runtime plan** generated `Analytics.plan` makes plan metadata available at runtime
74+
- **Type‑safe analytics** - compile‑time checking of event names and parameter types
75+
- **YAML → Dart generation** - write your plan once; emit strongly‑typed methods
76+
- **Domain-per-file** - a clean file per domain for readable diffs and code review
77+
- **Multi‑provider support** - fan‑out events to multiple analytics backends
78+
- **Exports & docs** - optional CSV/JSON/SQL/SQLite and generated Markdown for stakeholders
79+
- **Deterministic output** - fingerprinted and sorted generation prevents noisy diffs
80+
- **Watch mode & cleanup** - safe incremental regeneration; outputs cleaned before emit
81+
- **Runtime plan** - generated `Analytics.plan` makes plan metadata available at runtime
8282

8383
## When to use
8484

@@ -168,7 +168,7 @@ import 'src/analytics/generated/analytics.dart';
168168
void main() {
169169
// Initialize once
170170
Analytics.initialize(YourAnalyticsService());
171-
171+
172172
// Use anywhere in your app
173173
Analytics.instance.logAuthLogin(method: 'email');
174174
Analytics.instance.logAuthLogout();
@@ -179,10 +179,10 @@ void main() {
179179
180180
## Why this approach
181181

182-
- **Readable** domain-per-file keeps each area focused and reviewable
183-
- **Maintainable** changes to one domain arent scattered across the codebase
184-
- **Scalable** new domains dont bloat a single generated file
185-
- **Simple imports** a barrel file provides one canonical import for generated events
182+
- **Readable** - domain-per-file keeps each area focused and reviewable
183+
- **Maintainable** - changes to one domain aren't scattered across the codebase
184+
- **Scalable** - new domains don't bloat a single generated file
185+
- **Simple imports** - a barrel file provides one canonical import for generated events
186186

187187
## Configuration
188188

@@ -275,12 +275,12 @@ screen:
275275

276276
- Domain keys (top-level YAML keys) must be snake_case, using only lowercase letters, digits, and underscores (e.g. `auth`, `screen_navigation`).
277277
- This keeps generated file and class names stable and filesystem‑safe.
278-
- Each event's effective nameeither the optional `event_name` override or the default `<domain>: <event>` stringmust be unique across your entire tracking plan. Duplicate names cause the parser to throw a `FormatException`, which surfaces immediately when you run the generator (including `--validate-only`), preventing conflicting analytics payloads from being emitted.
278+
- Each event's effective name-either the optional `event_name` override or the default `<domain>: <event>` string-must be unique across your entire tracking plan. Duplicate names cause the parser to throw a `FormatException`, which surfaces immediately when you run the generator (including `--validate-only`), preventing conflicting analytics payloads from being emitted.
279279

280280
## Validation Guarantees
281281

282282
- `dart run analytics_gen:generate --validate-only` (or any run that parses your YAML) now enforces the same uniqueness constraint, so duplicate event names fail fast before any generated files are written.
283-
- Since the parser sorts files, domains, and events before visiting them, every validation failure is predictable and repeatableno ordering surprises in CI or on different machines.
283+
- Since the parser sorts files, domains, and events before visiting them, every validation failure is predictable and repeatable-no ordering surprises in CI or on different machines.
284284
- `dart run analytics_gen:generate --plan` prints the parsed tracking plan (domains, events, parameters, and fingerprint) so you can inspect instrumentation without writing any generated files.
285285

286286
## CLI Commands
@@ -427,9 +427,9 @@ filtered.logEvent(name: 'auth_login'); // only sent to amplitude
427427
```dart
428428
class FirebaseAnalyticsService implements IAnalytics {
429429
final FirebaseAnalytics _firebase;
430-
430+
431431
FirebaseAnalyticsService(this._firebase);
432-
432+
433433
@override
434434
void logEvent({
435435
required String name,
@@ -474,15 +474,15 @@ Unit tests should initialize `Analytics` with `MockAnalyticsService` (or other a
474474
void main() {
475475
group('Analytics', () {
476476
late MockAnalyticsService analytics;
477-
477+
478478
setUp(() {
479479
analytics = MockAnalyticsService();
480480
Analytics.initialize(analytics);
481481
});
482-
482+
483483
test('logs login event', () {
484484
Analytics.instance.logAuthLogin(method: 'email');
485-
485+
486486
expect(analytics.totalEvents, equals(1));
487487
final event = analytics.events.first;
488488
expect(event['name'], equals('auth: login'));
@@ -523,14 +523,14 @@ Licensed under the Apache License, Version 2.0. See [`LICENSE`](LICENSE) for det
523523

524524
## FAQ
525525

526-
**Why YAML instead of defining events directly in Dart?**
527-
YAML keeps the tracking plan tooling‑agnostic: product and analytics teams can read and edit it, and you can export the same source of truth to code, docs, and data formats.
526+
- **Why YAML instead of defining events directly in Dart?**
527+
YAML keeps the tracking plan tooling‑agnostic: product and analytics teams can read and edit it, and you can export the same source of truth to code, docs, and data formats.
528528

529-
**Can I migrate existing events?**
530-
Yes. Start by describing your current events in YAML, generate Dart code, then gradually replace existing manual `logEvent` calls with the generated methods.
529+
- **Can I migrate existing events?**
530+
Yes. Start by describing your current events in YAML, generate Dart code, then gradually replace existing manual `logEvent` calls with the generated methods.
531531

532-
**Does this lock me into a single analytics provider?**
533-
No. You implement `IAnalytics` adapters for each provider and can use `MultiProviderAnalytics` to send the same event to several backends.
532+
- **Does this lock me into a single analytics provider?**
533+
No. You implement `IAnalytics` adapters for each provider and can use `MultiProviderAnalytics` to send the same event to several backends.
534534

535-
**Is this safe to commit to source control?**
536-
Yes. The YAML definitions and generated code are designed to be code‑review friendly and should live in your repo alongside application code.
535+
- **Is this safe to commit to source control?**
536+
Yes. The YAML definitions and generated code are designed to be code‑review friendly and should live in your repo alongside application code.

0 commit comments

Comments
 (0)