PostHog / PostHog/posthog-flutter
Add capture per-event context options (distinctId, groups, timestamp)
Nobody has claimed this yet.
- Dominant language
- Dart
- Stars
- 97
- Forks
- 85
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 31
Description
Feature request
Add Flutter SDK support for the mobile capture spec's optional per-event context fields:
distinctIdoverridegroupscontexttimestampoverride
Why
The sdk-specs capture mobile variant includes optional per-event identity override, group context, and timestamp. These are useful for backfilled/offline/domain events where the event context differs from the SDK's current ambient user/session state.
Spec: https://github.com/PostHog/sdk-specs/blob/main/openspec/specs/capture/spec.md
Current Flutter behavior
Posthog().capture() currently only accepts:
eventNamepropertiesuserPropertiesuserPropertiesSetOnce
The platform interface also has a TODO noting missing capture parameters:
posthog_flutter/lib/src/posthog.dartposthog_flutter/lib/src/posthog_flutter_platform_interface.dart
Desired outcome
Expose and forward the missing optional context fields through the Dart API and platform bridges, preserving existing behavior for callers that do not provide them.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the capture API in posthog_flutter/lib/src/posthog.dart and the TODO in posthog_flutter/lib/src/posthog_flutter_platform_interface.dart. Trace how capture calls pass through the platform bridges, then add the optional fields while preserving existing calls without them. Verify that distinctId, groups, and timestamp reach the native implementations according to the linked capture spec.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, flutter
- Domain
- mobile-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100