PostHog / PostHog/posthog-flutter

Add capture per-event context options (distinctId, groups, timestamp)

Open
#445 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
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:

  • distinctId override
  • groups context
  • timestamp override

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:

  • eventName
  • properties
  • userProperties
  • userPropertiesSetOnce

The platform interface also has a TODO noting missing capture parameters:

  • posthog_flutter/lib/src/posthog.dart
  • posthog_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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.